Jump to content
Sign in to follow this  
13lack13lade

for to loop

Recommended Posts

13lack13lade

i have a loop which does the below, now the $count is equal to a cell in excel that has 14 in it.. so i wanted the loop to do it 14 times however it is doing it 15 times.. is that because the first 1 does not count as the 14?

*EDIT* had a play myself appear that, that is the case..  so i will just subtract all values by 1 to counter :) otherwise i could just simply change my code to " 0 to $count "

if $lenclip <=7 Then
   for $b = 1 to $count

      sleep(100)
      send("{TAB 9}")
      sleep(100)
       send("{DELETE 9}")
      sleep(100)
      send($ledger)
   next
else
      for $b = 1 to $count
      sleep(100)
      send("{TAB 8}")
      sleep(100)
       send("{DELETE 9}")
      sleep(100)
      send($ledger)
   Next
EndIf
Edited by 13lack13lade

Share this post


Link to post
Share on other sites
kylomas

13lack13lade,

Verify what value is in $count.  Run the following to see for...to loop increment behaviour.

local $end = 14

for $a = 1 to $end
    ConsoleWrite($a & @LF)
next

kylomas


Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

Share this post


Link to post
Share on other sites
13lack13lade

thanks guys, much appreciated!

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.