How to get a path of the file name in node js - node.js

I'm working on desktop application using electronjs .I have name of the exe of application such as calculator,spotify,..etc . I want to launch those application from my electron application. In order to launch it I need path of those application exe. Is there any node js npm to ahcieve this or any electron library methods.

I am afraid if there is a package who does that. ( you can still google and see if you find anything).
How I would have approached this, I would save the executable path in environment variable and then run the program (you can google how to do that. typically you just spawn a process and pass arguments to it) based on the passed name.
thanks

Related

Using Node.dll binary to execute JS in Win32

As the title says, I would like to run a JS file from within my application. I dont want to create a node.exe process. Is there any sample example to start with?
Edit:
I plan to use standalone dll that comes with electron installer - https://www.npmjs.com/package/electron-installer-windows
or build it myself using electron instructions
If you just need run JavaScript in a Windows app, you can use ActiveScript instead.
Otherwise this doesn't seem like a programming question.

How to run ElectronJs without a UI?

As well as a UI, I'd like users to have the option of passing in command line options to my tool and for it to output the response to the command line (eg manually or in cron).
Even without creating a window, the UI gets going (eg taskbar on the mac), and on a linux back-end server with no UI libraries it crashes completely.
Is there a way I can avoid having to ship two apps separately, and also more annoyingly using electron to package up one exe, and something like pkg for the other?
Thanks!
You can use a bundling tool like EncloseJS to wrap your Electron application. This would allow you to write a CLI interface. You would then need to move the code that does the actual work to a shared library that both Electron and your CLI can use. You could then introduce a --headless flag that would simply not start the Electron app, while omitting the flag would start the app as usual.

Cannot find module 'nw.gui' - node webkit updater

I'm trying to use node webkit updater for my aplication,but when i'm trying to test is(using npm test) or start it(using nmp start) i'm receiving this error .Both commands are used from Nodejs command prompt .
The js file used is updaterClientABC.js and the error comes from this line: var gui = require('nw.gui');
This is my folder structure :
Can you please tell me what should i do ? I admit that i am a beginner i've never worked with node-webkit.Some advices will be very helpful :)
I noticed this thread:
node module 'nw.gui' not found
So yes, this kind of thing is due to how NW.js gets called (directly or from within a project). I've run into this problem as well. In this case, in the above, you call updaterClientABS.js directly from node.js. To run a node-webkit project you need to load it via the NW.js binary, which in turn requires node.js.
It's also possible, as was my problem with this, that I was trying to access the nw.gui within the Node context (vs browser context). My solution was to access it via the browser context (which has more global access, not just Node.js objects).

Start app on mac os directly after installation

I'd like to know if it is possible to create a dmg file which can be installed by Drag&Drop - and which starts directly after this installation without having to be called manually again.
And if this is possible, I'd like to know whether I can pass arguments to the (nodejs) process which will be started directly after the installation.
I managed to pass parameters to the process when I call it manually after the installation, but I want to run it directly.
Any help will be appreciated!
Thanks!
I solved it: Instead of creating an app and wrapping it into a dmg, I created an app and wrapped it into a pkg. For pkgs it is possible to use postinstall scripts, so I started the application through this script.

Deploy a node.js application (windows)

for a customer of mine i'm developing a node.js app.
I want to give him a simple setup program that handle the installation of node and relative modules in automatic without having to access the web.
Which is the best and efficient way to do that?
Thanks in advance
Just give him the node.js installer und zip your app (with node_modules directory). He just has to install node.js and extract the zip file. You could write a .bat file which starts the app. That should be easy enough.

Resources