atzoref Posted January 15, 2012 Share Posted January 15, 2012 (edited) Hi, I see some scripts, and for example in some functions they uses some variables which declared in the main script after the line of calling to the function. So my question is if the order in the script is matter? Thanks. Edited January 15, 2012 by atzoref Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2012 Share Posted January 15, 2012 (edited) Yes, if you try to access a variable, before it is declared, you will get an error. Global $1 = 1 Global $2 = 2 Global $3 = 3 _Test1() Global $4 = 4 _Test2() Global $5 = 5 Func _Test1() MsgBox(0,0,$1 & $2 & $3) EndFunc Func _Test2() MsgBox(0,0,$1 & $2 & $3 & $4 & $5) EndFunc EDIT: But the position of any function you might create does not matter, they are read before execution of the script. Edited January 15, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
atzoref Posted January 15, 2012 Author Share Posted January 15, 2012 Because I see a function like this: GUICtrlSetOnEvent($ID, "Some Func") it calls to function which use "X" variable but this "X" variable declare just after thie line: GUICtrlSetOnEvent($ID, "Some Func") How can that be? Link to comment Share on other sites More sharing options...
bogQ Posted January 15, 2012 Share Posted January 15, 2012 (edited) maybe if you post workable script we can see, note that included UDF-s have in them declared variables so command 4 example GUICreate("", 169, 68, 20, 20, $WS_POPUP) will need #include <WindowsConstants.au3> that have $WS_POPUP declared in UDF Edited January 15, 2012 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
JohnOne Posted January 15, 2012 Share Posted January 15, 2012 Because I see a function like this:GUICtrlSetOnEvent($ID, "Some Func")it calls to function which use "X" variablebut this "X" variable declare just after thie line:GUICtrlSetOnEvent($ID, "Some Func")How can that be?So move it to before that line if it causing problem. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. 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