Need some help on a loop script Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
haze
Posts: 2
Joined: 30 Apr 2018, 13:44

Need some help on a loop script

14 Aug 2018, 05:54

So uh,i need some help, i want a script so that when you press U, it presses "o", after 2 seconds, presses kp_end, then after 10minutes, presses "p" then after 2seconds, it pressed kp_end again, then loops around, bit complicated, i hope i explained it well enough
User avatar
Scr1pter
Posts: 1275
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Need some help on a loop script  Topic is solved

14 Aug 2018, 06:36

Hi,
that would be the script:

Code: Select all

u::
while !stop
{
  Send o
  Sleep, 120000 ; 120000 ms pause = 120 sec pause = 2 min pause
  Send {Numpad1}
  Sleep, 600000 ; 600000 ms pause = 600 sec pause = 10 min pause
  Send p
  Sleep, 120000 ; 120000 ms pause = 120 sec pause = 2 min pause
}
return

Esc::
stop = 1
return
When you press Esc, the loop will stop (but it will run till the end).

Alternatively, you could use this code, which will kill the script immediately.

Code: Select all

u::
Loop
{
  Send o
  Sleep, 120000 ; 120000 ms pause = 120 sec pause = 2 min pause
  Send {Numpad1}
  Sleep, 600000 ; 600000 ms pause = 600 sec pause = 10 min pause
  Send p
  Sleep, 120000 ; 120000 ms pause = 120 sec pause = 2 min pause
}
return

Esc::
ExitApp
return
Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09
haze
Posts: 2
Joined: 30 Apr 2018, 13:44

Re: Need some help on a loop script

14 Aug 2018, 06:40

Thanks mate! <3<3 but uh, needed it to be 2second pause, not 2 minutes, but thas fine.
User avatar
Scr1pter
Posts: 1275
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Need some help on a loop script

14 Aug 2018, 07:34

Nice that I could help you!
Sorry, seems I missed that, but you can easily change it - probably you've already done it :)

Regards
Please use [code][/code] when posting code!
Keyboard: Logitech G PRO - Mouse: Logitech G502 LS - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.33.09

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], jollyjoe, just me, Rohwedder and 306 guests