Guest Toba Posted September 28, 2004 Share Posted September 28, 2004 Hi, just have a small question concerning global variables in external scripts. Given two scripts, env.au3 and functions.au3, I'd like to define some global variables in the first one, env.au3, which I want to access in the functions.au3. Therefor I include the env.au3 in functions.au3 with #include "env.au3". Seems it doesn't work, AutoIt complains in 2nd script about variables, which have not been declared first. Any ideas? Thx in advance Thomas Link to comment Share on other sites More sharing options...
MHz Posted September 28, 2004 Share Posted September 28, 2004 I can get 2 scripts communicating? Example: 1.au3 Global $jim, $mary $jim="Script 1 Variable" MsgBox(0, "Title", "Scripr 1 Test 1 jim = " & $jim) #include "2.AU3" foo() Func foo() MsgBox(0, "Title", "Script 1 Test 2 mary = " & $mary) EndFunc 2.au3 $mary="Script 2 variable" MsgBox(0, "Title", "Script 2 Test 1 jim = " & $jim) foo2() Func foo2() MsgBox(0, "Title", "Script 2 Test 2 mary = " & $mary) EndFunc Or can move $mary or/& $mary = ... to other script and still works? Link to comment Share on other sites More sharing options...
Guest Toba Posted September 28, 2004 Share Posted September 28, 2004 Thx for your quick reply. Seems your example works, so I guess I got something other wrong in my script. I can get 2 scripts communicating? Example: 1.au3 Global $jim, $mary $jim="Script 1 Variable" MsgBox(0, "Title", "Scripr 1 Test 1 jim = " & $jim) #include "2.AU3" foo() Func foo() MsgBox(0, "Title", "Script 1 Test 2 mary = " & $mary) EndFunc 2.au3 $mary="Script 2 variable" MsgBox(0, "Title", "Script 2 Test 1 jim = " & $jim) foo2() Func foo2() MsgBox(0, "Title", "Script 2 Test 2 mary = " & $mary) EndFunc Or can move $mary or/& $mary = ... to other script and still works? <{POST_SNAPBACK}> 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