How can I make this script stop itself but also with a keybind function? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
NAZOR
Posts: 3
Joined: 21 Mar 2021, 02:27

How can I make this script stop itself but also with a keybind function?

14 Apr 2021, 09:09

Hello!

I am new to autohotkey and it would be cool if someone explained a script to me.

I have a code that loops LMB and W. It also has keybinds so you can stop it manually with Z and C.
My questions is: How can I add something that after 30 minutes the script stops and then continues after 1 minute. Is it possible to make it work with the Z and C keybinds that stop the script manually?

Code: Select all

^LButton::
send {LButton down}
loop
{
   if getkeystate("z")
    {
      break
    }
  sleep, 50
}
send {LButton up}
return

^q::
send {W down}
loop
{
   if getkeystate("c")
    {
      break
    }
  sleep, 50
}
send {W up}
return
Please help!
Rohwedder
Posts: 7630
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: How can I make this script stop itself but also with a keybind function?  Topic is solved

14 Apr 2021, 10:13

Hallo,
untested:

Code: Select all

Stop := False
SetTimer, Stop,% 30*60*1000 ;30 minutes
Return
Stop:
Stop := !Stop
SetTimer, Stop,% Stop?60*1000:30*60*1000
Return
^LButton::
send {LButton down}
While, !getkeystate("z") And !Stop
	sleep, 50
send {LButton up}
return
^q::
send {W down}
While, !getkeystate("c") And !Stop
	sleep, 50
send {W up}
return

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, scriptor2016 and 284 guests