crazyjts Posted August 30, 2009 Posted August 30, 2009 I'm trying to figure out how to increment a variable while working thru a do...until loop. Func Deploy () ;dbl-clicks the location $k = 1 Do $CrntLocx = $Loc & $k & x ;I'm trying to get this value to increment each time thru e.g Loc1x, Loc2x, Loc3x, etc. $CrntLocy = $Loc & $k & y ;I'm trying to get this value to increment each time thru e.g Loc1y, Loc2y, Loc3y, etc. MouseClick ("left",$CrntLocx,$CrntLocy,2) Sleep(1000) $k = $k + 1 Until $k = 10 EndFunc Thanks for any help
Coolw Posted August 30, 2009 Posted August 30, 2009 Have you tried an array for the x and y value instead? My ProgramsMy WIP'sSteam Server Restarter
martin Posted August 30, 2009 Posted August 30, 2009 I'm trying to figure out how to increment a variable while working thru a do...until loop. Func Deploy () ;dbl-clicks the location $k = 1 Do $CrntLocx = $Loc & $k & x ;I'm trying to get this value to increment each time thru e.g Loc1x, Loc2x, Loc3x, etc. $CrntLocy = $Loc & $k & y ;I'm trying to get this value to increment each time thru e.g Loc1y, Loc2y, Loc3y, etc. MouseClick ("left",$CrntLocx,$CrntLocy,2) Sleep(1000) $k = $k + 1 Until $k = 10 EndFunc Thanks for any help What you need is Eval I think $CrntLocx = Eval("Loc" & $k & "x") $CrntLocy = Eval("Loc" & $k & "y") Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
crazyjts Posted August 30, 2009 Author Posted August 30, 2009 I ended up getting the Execute function to do what I wanted. $CrntLocx = Execute("$Loc" & $k & "x") $CrntLocy = Execute("$Loc" & $k & "y")
Manjish Posted August 31, 2009 Posted August 31, 2009 Assign() function will help you here to define your variables and assign them any value you need.. Eval() will help u in using the value stored in those variables. [font="Garamond"]Manjish Naik[/font]Engineer, Global Services - QPSHoneywell Automation India LimitedE-mail - Manjish.Naik@honeywell.com
jvanegmond Posted August 31, 2009 Posted August 31, 2009 Have you tried an array for the x and y value instead?@OP, why didn't you use an array? github.com/jvanegmond
WolfWorld Posted August 31, 2009 Posted August 31, 2009 You should never use Execute in your life trust me. Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets!
trancexx Posted August 31, 2009 Posted August 31, 2009 You should never use Execute in your life trust me.Why?I'm asking WolfWorld. ♡♡♡ . eMyvnE
trancexx Posted August 31, 2009 Posted August 31, 2009 Facing a tough audience is not easy. I'll be rating you WolfWorld. Every word counts. ♡♡♡ . eMyvnE
WolfWorld Posted September 1, 2009 Posted September 1, 2009 Why? I'm asking WolfWorld. First Sorry for the late reply. Autoit is a Weak Type (WT) language. As you may know: P this is already a weakness in the language (doesn’t get me wrong, WT language is easy to learn and use but in a bigger program it will get confusing and lead to the wrong result) Using Execute even forces that Weak Typed to be SUPER I mean SUPER (the weakest it can get!). Autoit does not check the syntax of the “execute” at all (string that you put in). And does not throw any error, if something goes wrong, try this Execute("MsgBox(0,'1','1')MsgBox(0,'2','2')") As yourself is this a valid syntax? The answer is yes and no, yes it runs properly, No it's not a valid syntax. There is no warning at ALL. You could evidently execute two commands without knowing. Now not everything works in execute, and Obfuscator does not like it also. It leads to hard to find bugs, the syntax does not highlight, Thing of Execute ("$i =+ 1") the =+ should be += but he typed in wrong. Is there any way to find that out? The answer is no. EVEN at RUNTIME. Look (assuming it work out in this case the ‘"’ is not balance so it won't work out) Execute ("MsgBox(0, ""'Box"'"",""Ink"")") Where does it go wrong? Lots of you, okay all of you without syntax highlighting will think Box is the problem BUT! Box is a valid string the problem is with Ink. This all prove the point of not using Execute (so you and run anything after compile), like not using Pointers in c(for speed) unless you really need to. Is this okay trancexx Main project - Eat Spaghetti - Obfuscate and Optimize your script. The most advance add-on.Website more of GadGets!
trancexx Posted September 1, 2009 Posted September 1, 2009 First Sorry for the late reply. Autoit is a Weak Type (WT) language. As you may know: P this is already a weakness in the language (doesn’t get me wrong, WT language is easy to learn and use but in a bigger program it will get confusing and lead to the wrong result) Using Execute even forces that Weak Typed to be SUPER I mean SUPER (the weakest it can get!). Autoit does not check the syntax of the “execute” at all (string that you put in). And does not throw any error, if something goes wrong, try this Execute("MsgBox(0,'1','1')MsgBox(0,'2','2')") As yourself is this a valid syntax? The answer is yes and no, yes it runs properly, No it's not a valid syntax. There is no warning at ALL. You could evidently execute two commands without knowing. Now not everything works in execute, and Obfuscator does not like it also. It leads to hard to find bugs, the syntax does not highlight, Thing of Execute ("$i =+ 1") the =+ should be += but he typed in wrong. Is there any way to find that out? The answer is no. EVEN at RUNTIME. Look (assuming it work out in this case the ‘"’ is not balance so it won't work out) Execute ("MsgBox(0, ""'Box"'"",""Ink"")") Where does it go wrong? Lots of you, okay all of you without syntax highlighting will think Box is the problem BUT! Box is a valid string the problem is with Ink. This all prove the point of not using Execute (so you and run anything after compile), like not using Pointers in c(for speed) unless you really need to. Is this okay trancexx Well, it's always important to know that there is syntax and there is semantics. Is it ok by me if I draw some parallels to Run() and related functions and say they equably suck? I wonder what would Manadar say about your Execute thoughts. ♡♡♡ . eMyvnE
jvanegmond Posted September 1, 2009 Posted September 1, 2009 Other people (Need I say names? I think not.) on this forum are far more knowledgeable on this subject, it would be wise to keep quiet on this one before I make a word slip. The only thing I can say for sure about Execute, is that it is a useful function if you use it the right way. #include <Array.au3> Dim $aArray[3][2] = [ [ 'a', 'b' ] , _ [ 'c', 'd' ], _ [ 'e', 'f' ] ] $iDimensions = UBound($aArray,0) $sDimensions = "" for $i = 1 to $iDimensions $sDimensions &= "[0]" Next $iValue = Execute("$aArray"&$sDimensions) MsgBox(0,"",$iValue) ; prompts with 'a' github.com/jvanegmond
trancexx Posted September 2, 2009 Posted September 2, 2009 The only thing I can say for sure about Execute, is that it is a useful function if you use it the right way.Like with any other function, right?WolfWorld said "You should never use Execute in your life trust me" and gives what seems to be explanation only in traces. Or am I reading wrong?The way I see it, that's not good WolfWorld. ♡♡♡ . eMyvnE
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