Code: Select all
init_this_file() {
static _ := init_this_file()
/*
This function is called automatically when the script starts,
regardless of where it is #included.
*/
}
Thomas
Code: Select all
init_this_file() {
static _ := init_this_file()
/*
This function is called automatically when the script starts,
regardless of where it is #included.
*/
}
Static Initializers: In versions prior to 1.0.46, all static variables started off blank; so the only way to detect that one was being used for the first time was to check whether it was blank. [v1.0.46+]: A static variable may be initialized to something other than "" by following it with := or = followed by one of the following: true, false, a literal integer, a literal floating point number, or a literal/quoted string such as "fox". For example: static X:=0, Y:="fox". Each static variable is initialized only once (before the script begins executing).
[AHK_L 58+]: Static var := expression is supported. All such expressions are evaluated immediately before the script's auto-execute section in the order they are encountered in the script.