0

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?

1
  • 1
    Please improve your question - e.g. add some details/be a bit more descriptive. Commented Sep 16, 2013 at 11:57

2 Answers 2

3

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.

Sign up to request clarification or add additional context in comments.

1 Comment

To explain a detail: The keys in RunOnce will be used once after the next reboot and then automatically be deleted by Windows...
1

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.