Sign in to follow this  
Followers 0
laffo16

a little help with this code

11 posts in this topic

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}")

Share this post


Link to post
Share on other sites



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...


1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

How about

While 1 to 100
Send("^{c}")
$1 = ClipGet()
$1 = StringTrimRight($1, 2)
Send("{down}")
WEnd


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

thanks for the replys, just popin out but bookmark this thread and test the code tommorow.

thanks again! deano

Share this post


Link to post
Share on other sites

How about

While 1 to 100
Send("^{c}")
$1 = ClipGet()
$1 = StringTrimRight($1, 2)
Send("{down}")
WEnd
good 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...

1100111 00001011101111 00011101101111 00010111100100 00001111110100 00110111110010 00101101111001 0011100i didn't make up this form of encryption, but i like it.credit to the lvl 6 challenge on arcanum.co.nz

Share this post


Link to post
Share on other sites

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))
WEnd

NotStringLen causes an error

While 1 to 100
    Send("^{c}")
    $1 = ClipGet()
    $1 = StringTrimRight($1, 2)
    Send("{down}")
WEnd

while 1 to 100 causes an error

summary

i'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.

Share this post


Link to post
Share on other sites

NotStringLen causes an error

Yes ... try a space between Not and StringLen()

while 1 to 100 causes an error

Did 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....


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

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].

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0