Keyword Reference


#OnAutoItStartRegister

Registers a function to be called when AutoIt starts.

#OnAutoItStartRegister "function"

Parameters

function The name of the user function to call.

Remarks

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 Dlobal within the script. All variables within the function are treated as Local.

Related

OnAutoItExitRegister

Example

#include <MsgBoxConstants.au3>

; Register Example() and SomeFunc() to be called when AutoIt starts.

#OnAutoItStartRegister "Example"
#OnAutoItStartRegister "SomeFunc"

Sleep(1000)

Func Example()
    MsgBox($MB_SYSTEMMODAL, "", "Function 'Example' is called first.")
EndFunc   ;==>Example

Func SomeFunc()
    MsgBox($MB_SYSTEMMODAL, "", "Function 'SomeFunc' is called second.")
EndFunc   ;==>SomeFunc