Reputation: 9
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?
Upvotes: 0
Views: 6505
Reputation: 1707
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.
Upvotes: 3
Reputation: 7160
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.
Upvotes: 1