I'd love to have a very simple yet very useful macro for me :
Basically as long as, say caps lock is on, let is spam LShift 10 times per second
Do you think you could make me that macro ? It'd be awesome !
LShift spammer
-
- Posts: 1
- Joined: 15 Mar 2018, 10:01
Re: LShift spammer
Code: Select all
SetTimer, Check, 0
return
Check:
If (GetKeyState("CapsLock", "T")) {
Send, {LShift}
Sleep 100
}
return
I am your average ahk newbie. Just.. a tat more cute.
Re: LShift spammer
Hallo,
1. #Persistent needed.
2. A timer with zero period and Sleep ??
better:
1. #Persistent needed.
2. A timer with zero period and Sleep ??
better:
Code: Select all
#Persistent
SetTimer, Check, 100
return
Check:
If (GetKeyState("CapsLock", "T")) {
Send, {LShift}
}
return
Re: LShift spammer
Huh why is persistent required?Rohwedder wrote:Hallo,
1. #Persistent needed.
2. A timer with zero period and Sleep ??
better:Code: Select all
#Persistent SetTimer, Check, 100 return Check: If (GetKeyState("CapsLock", "T")) { Send, {LShift} } return
And does it make a difference that settimer is at 0 and rather there is sleep under the label? It's the same thing right?
I am your average ahk newbie. Just.. a tat more cute.
Re: LShift spammer
Hallo,
#persistent is required because the script contains only a timer but not hotkeys, hotstrings, or any use of OnMessage() or Gui.
Just try it without!
A Sleep must be made by the currend thread. Waiting within the period of a timer, not!
https://autohotkey.com/docs/misc/Threads.htm
#persistent is required because the script contains only a timer but not hotkeys, hotstrings, or any use of OnMessage() or Gui.
Just try it without!
A Sleep must be made by the currend thread. Waiting within the period of a timer, not!
https://autohotkey.com/docs/misc/Threads.htm
Re: LShift spammer
Huh the script worked fine with my version too?Rohwedder wrote:Hallo,
#persistent is required because the script contains only a timer but not hotkeys, hotstrings, or any use of OnMessage() or Gui.
Just try it without!
A Sleep must be made by the currend thread. Waiting within the period of a timer, not!
https://autohotkey.com/docs/misc/Threads.htm
How would the script behave if #persistent was not written? Because I tried both your suggestions and my script and I didn't see a difference..
But does it make a difference whether the sleep was in the timer or the thread in this case? Because it won't execute it again until the thread is finished. Does it like take more resource or something? I didn't think it would make a difference..
I am your average ahk newbie. Just.. a tat more cute.
Re: LShift spammer
Hallo,
here the script ends immediately without #Persistent.
Compare:and
here the script ends immediately without #Persistent.
Compare:
Code: Select all
#Persistent
SetTimer, A, 300
SetTimer, B, 300
Return
A:
a:=!a
ToolTip, %a% %b%
Return
B:
b:=!b
Return
Code: Select all
#Persistent
SetTimer, A, 0
SetTimer, B, 0
Return
A:
a:=!a
ToolTip, %a% %b%
Sleep, 300
Return
B:
b:=!b
Sleep, 300
Return
Who is online
Users browsing this forum: Shoobis and 110 guests