McGod Posted May 13, 2006 Share Posted May 13, 2006 (edited) Im writing a big script. Only 300 lines and growing. While i work on it i usually save and try it to make sure it works. So it works for awhile then gives me the "variable is not declared" for every variable i have. The variables work while not in a function but when in a function they "variable is not declared" Snippet of code $moder = IniRead ( $ini, "Loader", "Modes", "-w -skiptobnet" ) Declaring variable Func Load () $window = StringinStr ( $moder , '-w', 0, 1 ) If $window = 0 Then MsgBox ( 1, "Error", "This script needs to be run in windows mode" ) Exit Else EndIf EndFunc Using $moder in Func load () gives me error Edit: If i take some code from it works in a differernt script but not in my script Edited May 13, 2006 by Chip [indent][center][u]Formerly Chip[/u][/center]~UDFs~[/indent][u]IRC.au3 - Allows you to connect to IRC ServersINetCon.au3 - Connects/Disconnects/Check Status of InternetHardware Key - Creates a unique hardware hashScriptComm - Allows you to communicate between scripts using WM_COPYDATA[/u][indent]~Programs~[/indent][indent]SimonAu3ForumsIRC Bot~Web Site~Web Autoit Example[/indent][indent][b][/b][/indent][u][/u] Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted May 13, 2006 Moderators Share Posted May 13, 2006 How are you declaring the variables? 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. Link to comment Share on other sites More sharing options...
PsaltyDS Posted May 13, 2006 Share Posted May 13, 2006 Im writing a big script. Only 300 lines and growing. While i work on it i usually save and try it to make sure it works. So it works for awhile then gives me the "variable is not declared" for every variable i have. The variables work while not in a function but when in a function they "variable is not declared" Snippet of code $moder = IniRead ( $ini, "Loader", "Modes", "-w -skiptobnet" ) Declaring variable Func Load () $window = StringinStr ( $moder , '-w', 0, 1 ) If $window = 0 Then MsgBox ( 1, "Error", "This script needs to be run in windows mode" ) Exit Else EndIf EndFunc Using $moder in Func load () gives me error Edit: If i take some code from it works in a differernt script but not in my script If the $moder = IniRead() is inside a function, and $moder is not declared outside any function then it is local by default, and therefore not avaiable outside the function. Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law 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