Page 1 of 1

Loop which add +1 command every loop

Posted: 18 Jun 2018, 08:45
by Calimero 0euf
Hello all,

I would like to make a script which add the same command +1 for each loop

here is my script but I would like to make it easier to write :
I want to avoid to write manually all steps if I have 100 steps to do for exemple

Code: Select all

!y::
; step 1
Send {space}
sleep 1000
click 1876,44
sleep 2000
Send {enter}
sleep 1000
Send {down 2} ; here is the command to add one more
sleep 60000

; step 2
Send {space}
sleep 1000
click 1876,44
sleep 2000
Send {enter}
sleep 1000
Send {down 3} ; here is the command to add one more
sleep 60000

; step 3
Send {space}
sleep 1000
click 1876,44
sleep 2000
Send {enter}
sleep 1000
Send {down 4} ; here is the command to add one more
sleep 60000

etc, continues indefinity
Thanks by advance !

Re: Loop which add +1 command every loop

Posted: 18 Jun 2018, 09:04
by eelrod
A_Index keeps track of loop iterations, starting with one. The following would send a once the first loop, twice the second, and so on, for a total of 15 times.

Code: Select all

!y::
Loop , 5
  Send , {a %A_Index%}
Return

Re: Loop which add +1 command every loop

Posted: 18 Jun 2018, 10:13
by Calimero 0euf
EXCELLENT !!!!

MEGA THANK YOU !!

You saved my life hahaha !