laffo16 Posted March 3, 2006 Share Posted March 3, 2006 Hello! a little new to autoit and am in need of some help with condensing the below code into a loop. i need the code to be looped 100 times ($1 $2 $3 to.. $100) and have had no luck in understanding how to use a loop function with this code. can someone guide me, thank you Send("^{c}") $1 = ClipGet() $1 = StringTrimRight($1, 2) Send("{down}") Send("^{c}") $2 = ClipGet() $2 = StringTrimRight($2, 2) Send("{down}") Send("^{c}") $3 = ClipGet() $3 = StringTrimRight($3, 2) Send("{down}") Link to comment Share on other sites More sharing options...
seandisanti Posted March 3, 2006 Share Posted March 3, 2006 Hello! a little new to autoit and am in need of some help with condensing the below code into a loop. i need the code to be looped 100 times ($1 $2 $3 to.. $100) and have had no luck in understanding how to use a loop function with this code. can someone guide me, thank you Send("^{c}") $1 = ClipGet() $1 = StringTrimRight($1, 2) Send("{down}") Send("^{c}") $2 = ClipGet() $2 = StringTrimRight($2, 2) Send("{down}") Send("^{c}") $3 = ClipGet() $3 = StringTrimRight($3, 2) Send("{down}") the code you're looking for would be something like: *untested $a = 1 While $a Send("^{c}") Assign($a, ClipGet()) If NotStringLen (Eval($a)) Then ExitLoop Assign($a, StringTrimRight(Eval($a), 2)) WEnd but if this is for excel (as it looks to be) we may have better ways to do what you want... Link to comment Share on other sites More sharing options...
BigDod Posted March 3, 2006 Share Posted March 3, 2006 How about While 1 to 100 Send("^{c}") $1 = ClipGet() $1 = StringTrimRight($1, 2) Send("{down}") WEnd Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
laffo16 Posted March 3, 2006 Author Share Posted March 3, 2006 thanks for the replys, just popin out but bookmark this thread and test the code tommorow. thanks again! deano Link to comment Share on other sites More sharing options...
seandisanti Posted March 3, 2006 Share Posted March 3, 2006 How about While 1 to 100 Send("^{c}") $1 = ClipGet() $1 = StringTrimRight($1, 2) Send("{down}") WEndgood call, i didn't read thoroughly enough to see that he wanted a fixed number of iterations, so i just set mine up to go till it hit a black copy... Link to comment Share on other sites More sharing options...
laffo16 Posted March 4, 2006 Author Share Posted March 4, 2006 just cant figure this one out, thanks for the replys you guys, here is what i find...$a = 1 While $a Send("^{c}") Assign($a, ClipGet()) If NotStringLen (Eval($a)) Then ExitLoop Assign($a, StringTrimRight(Eval($a), 2)) WEndNotStringLen causes an errorWhile 1 to 100 Send("^{c}") $1 = ClipGet() $1 = StringTrimRight($1, 2) Send("{down}") WEndwhile 1 to 100 causes an errorsummaryi'm using excel in open office. my objective is to save 100 cells of data (int) (vertical cells) and then call up this data 1 entry at a time in a msgbox. The data must be gathered from all 100 cells first before it then proceeds to the msgbox stage.anyhelp or advice at all appreciated. Link to comment Share on other sites More sharing options...
Developers Jos Posted March 4, 2006 Developers Share Posted March 4, 2006 NotStringLen causes an errorYes ... try a space between Not and StringLen()while 1 to 100 causes an errorDid you try to open the helpfile and read about any of this or are you just doing a Cut/Paste job and run the script ?Think a for..next loop was intended in this example.... SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
greenmachine Posted March 4, 2006 Share Posted March 4, 2006 If I were doing it, I would use an array and a for loop. Global $Array[101] For $i = 1 to 100 Send("^{c}") $Array[$i] = StringTrimRight (ClipGet(), 2) Send("{down}") Next Now you have an array of your text, with entries in $Array[1] to $Array[100]. Link to comment Share on other sites More sharing options...
laffo16 Posted March 4, 2006 Author Share Posted March 4, 2006 again thanks for the help. i have been using the References for help. not so familuar with the "Not" or "For" loop statements. still on the noob level :] i'll see if i can get this working now, thanks Link to comment Share on other sites More sharing options...
laffo16 Posted March 4, 2006 Author Share Posted March 4, 2006 If I were doing it, I would use an array and a for loop. Global $Array[101] For $i = 1 to 100 Send("^{c}") $Array[$i] = StringTrimRight (ClipGet(), 2) Send("{down}") Next Now you have an array of your text, with entries in $Array[1] to $Array[100]. just while the the topic is fresh, thanks greenmachine this worked fine Link to comment Share on other sites More sharing options...
w0uter Posted March 4, 2006 Share Posted March 4, 2006 @greenmachine 101 -> 100 and 1 -> 0 saves you like 4 (or maby 8 as C++ is weird) bytes of memory 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...
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