w0uter Posted October 15, 2005 Share Posted October 15, 2005 following snipetOpt("MustDeclareVars", 1) func exit2() Exit EndFunc$var = exit2()it doesnt error while i did not declare $var, bug ?dim $var = exit2()gives an "Error in expression", bug ?or is this intended. ifso how can i avoid this ? My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll Link to comment Share on other sites More sharing options...
Valik Posted October 15, 2005 Share Posted October 15, 2005 It looks like a bug to me. Link to comment Share on other sites More sharing options...
FuryCell Posted October 15, 2005 Share Posted October 15, 2005 (edited) Odd. I just tried the following with both the beta and the production version and got an error both times.Opt("MustDeclareVars", 1) func exit2() Exit EndFunc $Var=Exit2()The error was as follows:C:\Documents and Settings\Michael\Desktop\d.au3 (5) : ==> Variable used without being declared.: $Var=Exit2() ^ ERROR Edited October 15, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
theguy0000 Posted October 16, 2005 Share Posted October 16, 2005 (edited) Odd. I just tried the following with both the beta and the production version and got an error both times.Opt("MustDeclareVars", 1) func exit2() Exit EndFunc $Var=Exit2()The error was as follows:thats what its supposed to do.try this:Opt("MustDeclareVars", 1) func exit2() Exit EndFunc Dim $Var=Exit2()that should not error out. Edited October 16, 2005 by theguy0000 The cake is a lie.www.theguy0000.com is currentlyUP images.theguy0000.com is currentlyUP all other *.theguy0000.com sites are DOWN Link to comment Share on other sites More sharing options...
MHz Posted October 16, 2005 Share Posted October 16, 2005 I have not seen "MustDeclareVars" preprocess declarations so since the script exits before $var is filled with a value then should AutoIt error? If you replace Exit with Return 1 then you get the declaration error or if you use Dim it works fine. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 16, 2005 Share Posted October 16, 2005 It doesn't error in production version, only beta. I understand why it is a bug, but is a ret value expected when you send the exit keyword? No OnAutoItExit func is defined... Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) Link to comment Share on other sites More sharing options...
LxP Posted October 16, 2005 Share Posted October 16, 2005 No, a return value isn't expected even if an OnAutoItExit() function is defined because control will not (or at least should not) return to the caller of the function in either case. Link to comment Share on other sites More sharing options...
FuryCell Posted October 16, 2005 Share Posted October 16, 2005 (edited) It doesn't error in production version I get an error in the production version on my pc as my post says above.I am using the latest production version. (3.1.1.0) Edited October 16, 2005 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
MSLx Fanboy Posted October 16, 2005 Share Posted October 16, 2005 using the following code, it only has an 'error in expression' for the beta, not the prodOpt("MustDeclareVars", 1) func exit2() Exit EndFunc Dim $Var=Exit2()If you remove Dim and run the beta version, it does not error out, most likely because it processes exit2() before sending the return value to a variable, as I would expect. Writing AutoIt scripts since _DateAdd("d", -2, _NowCalcDate()) 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