Mars Posted April 4, 2009 Posted April 4, 2009 How do you make it so that you can use the variables and their values that were declared in a func outside of that function?
Authenticity Posted April 4, 2009 Posted April 4, 2009 Using the Global keyword as opposed to Local or Dim.
Mars Posted April 4, 2009 Author Posted April 4, 2009 I haven't been declaring them of any type so I'm guessing you just put global before the variable?
Moderators SmOke_N Posted April 4, 2009 Moderators Posted April 4, 2009 (edited) Yes, otherwise, local is assumed. I think.Local is only assumed if the variable is declared within a function (or used in a For/Next eg. For $i where $i would be declared local unless otherwise stated previously, if declared this way, it will be destroyed like a Local variable after the For/Next loop expires). Example of standard global distinction:$s_example1 = "apple" _badwaytodoit() Func _badwaytodoit() MsgBox(64, "$s_example1", $s_example1) EndFuncoÝ÷ ØÚ-uç%j¸§*.®ö«¦å{ûr¥ë"²Ø^²Ö«¶ÛiØZn+l~ߺ۫yÊx×¾ìb·öYl¢å¢Ç¬×¨Z·*.Á©í¶Þj hm©oj¸nW¨©hq©oj¸nW¢g)ඬ zܨº)íèZn+h}תâazgâ®Ëp¢é]mëh¦ëZºÚ"µÍÜ ][ÝÓ]ÝXÛUÉ][ÝËJAt the top of your scripts. Edited April 4, 2009 by SmOke_N Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.
Mars Posted April 4, 2009 Author Posted April 4, 2009 Okay that worked thanks. I learned autoit through playing around with it but right now I am in C++ classes and I will probably get in the habit of declaring variable types from now on.
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