Registers a function to be called when AutoIt starts.
#OnAutoItStartRegister "function"
| function | The name of the user function to call. |
As the function runs before any of the main script code is executed, the function cannot reference any variables defined in an #include nor any variables defined as Global within the script. All variables within the function are treated as Local.
#include <MsgBoxConstants.au3> ; cannot be used inside #OnAutoItStartRegister function
; Register Example() and SomeFunc() to be called when AutoIt starts.
#OnAutoItStartRegister "Example"
#OnAutoItStartRegister "SomeFunc"
Sleep(1000)
Func Example()
MsgBox(4096, "", "Function 'Example' is called first.") ; $MB_SYSTEMMODAL
EndFunc ;==>Example
Func SomeFunc()
MsgBox(4096, "", "Function 'SomeFunc' is called second.") ; $MB_SYSTEMMODAL
EndFunc ;==>SomeFunc