FreeSiker Posted December 25, 2007 Posted December 25, 2007 Hello, This function don't work because, it run before the variables are declared. Is it possible to make it work $test = "hello" Func OnAutoItStart() MsgBox (0, "test", $test) EndFunc Thank you
Developers Jos Posted December 25, 2007 Developers Posted December 25, 2007 You will have to define all needed vars in the Func itself: Func OnAutoItStart() Global $test = "hello" MsgBox(0, "test", $test) EndFunc ;==>OnAutoItStart SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
FreeSiker Posted December 25, 2007 Author Posted December 25, 2007 You will have to define all needed vars in the Func itself: Func OnAutoItStart() Global $test = "hello" MsgBox(0, "test", $test) EndFunc ;==>OnAutoItStart I know but the variable is not realy usable by the rest of the script Func OnAutoItStart() Global $test = "hello" MsgBox(0, "test", $test) EndFunc ;==>OnAutoItStart Func OnAutoItExit() MsgBox(0, "test", $test) EndFunc ;==>OnAutoItExit Result: C:\help post.au3(7,28) : WARNING: $test: possibly used before declaration. MsgBox(0, "test", $test) C:\help post.au3(2,27) : WARNING: $test: declared global in function only. Prefer top of file. Global $test = "hello"
Developers Jos Posted December 25, 2007 Developers Posted December 25, 2007 Its works fine... AU3Check gets confused but its works fine when you ignore the warnings . SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now