Loop which add +1 command every loop

Get help with using AutoHotkey and its commands and hotkeys
Calimero 0euf
Posts: 4
Joined: 18 Jun 2018, 08:02

Loop which add +1 command every loop

18 Jun 2018, 08:45

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 !
eelrod
Posts: 65
Joined: 10 Apr 2018, 11:17

Re: Loop which add +1 command every loop

18 Jun 2018, 09:04

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
Calimero 0euf
Posts: 4
Joined: 18 Jun 2018, 08:02

Re: Loop which add +1 command every loop

18 Jun 2018, 10:13

EXCELLENT !!!!

MEGA THANK YOU !!

You saved my life hahaha !

Return to “Ask For Help”

Who is online

Users browsing this forum: Albireo, Five One, just me, Odlanir, r2d2_986 and 189 guests