Close process in NSIS script during install - process

I plug nsProcess to close a running program but when I close it, a message will appear stating "Are you sure? OK - Cancel".
How can I automatically, during installation, chose option "Yes", without direct user intervention?
$ {nsProcess :: CloseProcess} "yahoomessanger.exe" $ R0

nsProcess::CloseProcess tries to be nice and posts WM_CLOSE to the application, use nsProcess::KillProcess to kill it without giving the app a chance to close properly...

Related

Electron threw a compile error and Windows command prompt goes non writable

So my code had an invalid syntax, which I was trying out to see if it works and while compiling I got App threw an error during load.
Now in the command-prompt the error is listed in detail with the cursor still blinking but NOT WRITABLE. Closing, re-opening, re-navigating and restarting with electron . only seems to work.
Can't do the same for many errors I might face. So, is there a way to not let that happen? How are you guys dealing with it? Is it in anyway connected to stopping the npm server? If it helps, I'm using a Win 7 64bit OS.
Found a way, which is to terminate the batch job by hitting CTRL + C, which asks Terminate batch job (Y/N)? where choosing Y terminates and makes the command prompt writable.
I was searching for methods to terminate without confirmation and learnt it cannot be terminated without confirmation.

Can I retrieve the output of a program, that is running in another terminal and/or run by root as e.g a cronjob?

Just for the sake of the question, say I open a terminal an log into my Linux computer. I run a program that keeps outputting information on my screen, looping. I close the terminal window, and the program shuts down.
I set up a cronjob or a startup script that launches the same program as in example 1. The program is looping now, run as root.
I open a terminal, and log into my computer through SSH. Can I make a Bash script that retrieves the output of said program, even if it's running somewhere in the background? I mean, is the program "virtually" outputting information (as in example 1)?
The program closes stdout and stderr when it exits. Looping it as you describe will just cause it to start and exit continuously. You could look at redirecting stdout and stderr.

Run AutoIT script after restart

I am running an Auto-IT script that installed a program. This program needs to be restarted, and then further configurations are made to it upon booting.
How do I continue my AutoIT script upon reboot with this program?
I assume, that you mean, your whole computer needs to be restarted, not only your program.
The easiest way to perform this, is to add the following to the beginning of your script:
If $cmdLine[1] <> "StartUp" Then
RegWrite("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce", "AutoItScript", "REG_SZ", #ScriptFullPath & " StartUp")
Else
StartUp()
EndIf
Func StartUp()
MsgBox(0, "AutoIt StartUp", "Script started on boot")
Exit 0
EndFunc
MsgBox(0, "AutoIt Normal Script Start", "Script started")
Just replace the MsgBox calls with your desired functionality.
This is untested code written from scratch with just some looks into the documentation, I'm too lazy to reboot my computer right now to test it... but you should get the idea.
There are a number of methods for running a programming on restart.
The easiest is just to copy it to the startup folder. After the program is run it can be deleted, there are examples on the forum of a self-deleting file as well.
Other methods include using the registry, and task scheduler. They might prove more reliable when you start to look at things like other users logging on than the original.
In any case, this is not AutoIt specific, but a general windows thing.

Using applescript to run terminal and passing a argument to compile

I am new to applescripts and i want to automate a little bit of my app.So here is the thing
1) I am using textwrangler as an editor
2) After writing code and saving it i want to compile the file by opening terminal from applescript.I already installed llvm compiler.
3) As textwrangler provides me the a menu in meubar to open script editor so after opening it i am using "tell application "Terminal" to activate" it opens terminal
4) i want " gcc myfilename.c " to be passed as argument from applescript so that as soon terminal opens this string should be passed as argument and executable is generated
Can i Do that through scripts? Please help.
Give this a try:
tell application "Terminal" to do script "gcc myfilename.c"
Running this without the Activate line you mentioned will still open Terminal if it isn't already open, but it won't bring it to the front. For that, Just turn the whole thing into a tell block and put the Activate back in there so it becomes:
tell application "Terminal"
activate
do script "gcc myfilename.c"
end tell

How to run a PHP script via SSH and keep it running after I quit

I'm trying to restart a custom IRC bot. I tried various commands :
load.php
daemon load.php
daemon load.php &&
But that makes the script execute inside the console (I see all the output) and when I quit the bot quits as well.
The bot author only taught me the IRC commands so I'm a bit lost.
You can install a package called screen. Then, run screen -dm php load.php and resume with screen -dR
This will allow you to run the script in the background, and still be able to use your current SSH terminal. You can also logout and the process will still be running.
Chances are good the shell is sending the HUP signal to all its running children when you log out to indicate that "the line has been hung up" (a plain old telephone system modem reference to a line being "hung up" when disconnected. You know, because you "hang" the handset on the hook...)
The HUP signal will ask all programs to die conveniently.
Try this:
nohup load.php &
The nohup asks for the next program executed to ignore the HUP signal. See signal(7) and the nohup(1) manpages for details. The & asks the shell to execute the program in the background.
Clay's answer of using screen(1) is pretty awesome, definitely look into screen(1) or tmux(1), but I don't think that they are necessary for this problem.
This line might help you
php load.php &