How to add my nodejs server to startup program of window? - node.js

I want the server made with Node.js to start automatically when Windows is operating.
I know that Windows runs the exe files in the StartUp folder when it is run.
But I've never made an exe file. (I am not sure how to do it).
I think there are probably many different ways to accomplish what I'm trying to do.
I'm not sure which way would be more efficient.
Please advise.
I prefer to create automatic commands with the .sh.
It would be great if you could do it this way.

Related

Is there a way to see what a .cgi file contains scripting wise?

I work with remotely installed cameras that have a linux build installed in them. Our previous models allowed us to use SSH and run simple commands within their terminal to focus the image, reboot, factory default and the such without having to go to the remote location. We have swapped to a new kind of camera that still has a linux build inside but the previous commands are not as easily accessible if at all. These new cameras have a simple website that can do these actions instead but this can - and has - go wrong with a need for the SSH solution.
There is no way to directly access the camera (that I know of), all of this is through a cat6. I checked the source for the simple website trying to see what the focus button actually runs onclick and found its javascript refers to "/cgi-bin/focus.cgi" (I can provide the chunk of code if needed). I am familiar with programming but not to any pro degree and much less web development but I figure that .cgi might be my ticket to finding out how to activate this stuff from the linux terminal.
I tried making a python script to see if I could read the file in plain text or something but that's a no go. Don't know the first thing about web dev so if there is a neat tech way to open the server on the camera to pick its brains I don't know what it is and don't know where to start. Currently bouncing around all the directories in the camera trying to find some kind of command or clue to where the camera functions are. Double tab doesn't seem to have the commands I'm looking for, and they didn't include a manual with man command. I'm completely lost.

It is possible to track what apps are in use and what file is opened with nodejs

For a future project, I need to track user activity to record their productivity time. I want to detect which file is currently open in apps like Adobe Photoshop for example and detect when the user switches to other app or another file/tab.
To make my desktop app, I wish to use electron JS
Can you just give me some tracks to follow ?I don't find any nodejs library that allow me to do that, but I know that is possible because it already done with electron apps like:
Chronos https://electronjs.org/apps/chronos-timetracker
Paymo https://electronjs.org/apps/paymo-time-tracker
ScreenAware https://electronjs.org/apps/screenaware
And an other App which not seems to be built with electron :
https://desktime.com/features
Thanks for your help
node.js doesn't have the capabilities you require, however it can call external programs to get the job done. The way I see it, you would need to have a PowerShell script (or C# program) to get the active window from the operating system, and find all open file handles for the process behind that window. You would invoke this script from node, and build your gui around it.
A good starting point is this module active-window which works exacty as I described: a nodejs process calls some external scripts (in bash/PowerShell) that use OS specific primitives to get the active window.
To get the list of files opened by a process, you could use the handle utility from Sysinternals. However you may run into a small problem: apps like Photoshop usually don't keep the file handle open, they just open it when saving the file. This means that you won't always be able to detect open files. I guess trial and error is your friend here.
To find open tabs, it's more complicated. Tabs usually indicate the internal state of an app, and this information is held in memory. Some apps might offer an API, but that's not guaranteed. I guess screenshots are the way to go here.

How do I run code without the PyCharm IDE

Now that I am done with my project that was developed using PyCharm in a virtual environment, I need to distribute the code to my work machine; however, I am not certain on how to do this. Do I need to create a build of sorts so the code an run independently of the PyCharm IDE? Can someone please point me to the correct documentation on this crucial next step?
This really depends on what and how you're using the code for. If you just want to run it on your computer and it's a single file, you can open the command line/terminal and type python3 your_file_name and it will run the file (where your_file_name is the path to your .py file from whatever directory you're in). I assume you have python installed on your work machine, but if not, go here:
https://www.python.org/downloads/
If you have a more complex project or you want to deploy your code on a website or a server, these are probably good places to start.
https://www.jetbrains.com/help/pycharm/deploying-applications.html
https://docs.python.org/3.0/howto/webservers.html
EDIT: Added this as another useful link:
https://docs.python-guide.org/dev/virtualenvs/

tideSDK autorun program

I am creating an exe application with tideSDK and I wondering is it possible to make my program autorunning with system. It can be installer or anything else, but I am searching any way to do that.
Depending on operating system you need to do different things to achieve what you want.
For windows you can place the shortcut in Start -> All Programs --> Startup folder to start your application at Startup time.
For linux systems you need to modify init scripts.

Running a Qt application at startup

I wrote a Qt application that is going to run on Linux. It supposed to run at startup.
It's supposed to run on every Linux- Suse, RedHat etc.
What script should I write and Where to put it?
I don't know how to write scripts at all, so I would appreciate it if you will attach an example.
You need to create a desktop entry file for your application (see here) and to put it in user's $HOME/.config/autostart directory.
Any desktop entry file in that dir will get executed when a Window Manager starts up (see here).
To do this, usually you'll need to create your desktop entry file by hand (that's it, not via C++ code/script) and to just install in that directory via C++ code.

Resources