FreeSiker Posted December 25, 2007 Share 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 25, 2007 Developers Share 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. Link to comment Share on other sites More sharing options...
FreeSiker Posted December 25, 2007 Author Share 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" Link to comment Share on other sites More sharing options...
Developers Jos Posted December 25, 2007 Developers Share 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. Link to comment Share on other sites More sharing options...
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