I'am currently writing an application that has to search on a web site if an update exists for this application. If it is the case the application download a setup file (created with inosetup) and then execute it.
My application is written in C++. And I do not arrive to do this process. I'am trying to call the setup using system(). If the command is system("mysetup") I cannot obtain what I want because the setup cannot replace the exe (currently running). So, I have tried to use system("cmd /C mysetup"), system("cmd/C start /min mysetup"), system ("cmd /C start /min /separate mysetup") without success. In these cases, the fact to stop the application also stop the setup. So I suppose that the setup is considered as a child process.
I have seen in some posts that it might be possible to use execcl(). But this function is in unistd.h. And this library is a little bit to specific for my needs (I need to be able to run on virtualized windows).
So do you have a way to do what I want?
Thanks for your help
OK,
A colleague to me gave me the solution. As we are using QT a QProcess::startDetached does exactly what I want.
Related
i just started working with python and with some scripts to automate some tasks. I manage to create a web scraper using selenium that notifies me daily with the latest news via a mail . Now the script works great if i run it manually , but my question is : How can i make the script to run automatically every day , and what option would you recomand . I know that you can use TaskScheduler and program it , but i was wondering if you know any options to run it directly in the cloud ? Also , i found some tutorials where they say to wrap all the code in an infinite loop and add a timer , and once you run the script it will stay active as a background process,
I just started working with scripts and automation , so i would really like to know your opinion on the best way to run the script automatically . Thanks a lot
If this is on a unix-based OS, check out cron (this is a pretty good guide). You can schedule it to run your python script daily.
Im not sure if that is what you are looking for, but (if you are on windows) you could attach your program to your autostart. Probably your Startup Folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
If you schedule in your computer, i think it may not be proper solution. It's better to deploy it on any cloud platforms & schedule at any particular time.
I personally suggest Heroku, I'm using it for running multiple scripts for free. You can use scheduler addon for scheduling scripts to run at particular time as well. Please refer to heroku documentation & get started! Note: The script may run more time than you expected, please refer here to fix this.
I have developped a little app in NodeJs which read and write some files. These files are stored on a shared folder of my local network. Everything was working until I tried to start NodeJs as Windows Service through NSSM (a little .exe that allows you to transform a .bat to a Windows Service).
In fact, fs.readFile doesn't work anymore so i can't use it, and i don't see where does the problem come from.
In addition, fs.existsSync("\\\\10.200.10.1\\reporting\\") returns false, but fs.existsAsync("\\\\10.200.10.1\\reporting\\") returns true.
I also tried some other functions like fs.access and it doesn't work either.
I would be grateful if someone could tell me how i can make this work. I don't really care about NSSM, my only goal is to make my Node App works as Windows Service, so if an other tool can resolve my issue, let's tell me.
I don't know if it's the same problem, but I have an other thing which doesn't work in service mode : Execute VBS from Nodejs in background mode (Tasks Scheduler or Windows Service)
I, I'm writing an app with electron (http://electron.atom.io/). I would like to deactivate the monitor/display of the pc and only activate it again, when something in the app happens (for energy-saving). Is there a way to do this?
The only think I found, is the powerSaveBlocker (http://electron.atom.io/docs/api/power-save-blocker/) which doesn't help me...
You'll need to use native system APIs to do this, on Windows you can use one of the solutions proposed in Turn on/off monitor.
One of the ways you can do that is by executing batch files from electron/node in Windows , shell scripts in Linux and whatever MAC OS uses to execute commands.
These scripts would contain the OS level commands to turn on/off the display which are easily available .
When to fire these scripts would depend on your application logic .
I have a Node Server.
And I want that my Node Server starts automatically when my Pc Starts.
Right Now I am doing this Manually.
Like this:
1) First I open Command Prompt.
2) Than I Type
cd node
3) Thank I type
node server.js
I want these 3 Step to perform automatically when my Pc starts.
Any solution please ?
The simple way would be to write a .bat script that you launch on startup.
Another option, that I personally would have used, is node-windows (or other modules like it) to create a Windows Service, running it in the background. You can specify if you want your Service to start automatically in the background or not when Windows starts.
Write a simple .bat script and add the script as described here.
Assuming you mean Windows (cmd), this should work for you. Also it might be a good idea to specify an absolute path for the node executable, and/or file.
I have a QT application. When I use my created application launcher to start it, it doesn't work.
However, if I go to terminal and run the application from there, it works.
I'm wondering what their differences are.
Thanks.
Maybe your application launcher doesn't contain the right command and environment?
How is your launcher trying to start the program? Are any errors being reported?
It could be that the current directory is not set as expected. Or the command line parameters being sent aren't formatted correctly. Hard to say without seeing some code or an error message.