 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
dev Guest
|
Posted: Thu Jul 05, 2007 2:25 am Post subject: Help with a script |
|
|
Hi, I need help with a script that spams the F1 key. So far I have
| Code: | *PAUSE::Suspend
return
*F1::
Loop
{
GetKeyState,state,F1,P
if state = U
break
Send,{F1}
Sleep,10
}
return |
However that only spams it if I hold down F1. Is there any way to have it spam F1 continuously by pressing it once and then stop spamming by pressing it a second time? |
|
| Back to top |
|
 |
nick
Joined: 24 Aug 2005 Posts: 345 Location: Berlin / Germany
|
Posted: Thu Jul 05, 2007 7:02 am Post subject: |
|
|
| Code: | #MaxThreadsPerHotkey 2
$*F1::
_Break := False
If (_F1)
{
_F1 := False
_Break := True
Return
}
_F1 := True
Loop
{
If (_Break)
{
Break
}
Send, {F1}
Sleep, 10
}
Return |
$ This is usually only necessary if the script uses the Send command to send the keys that comprise the hotkey itself, which might otherwise cause it to trigger itself. The exact behavior of the $ prefix varies depending on operating system:
On Windows NT4/2k/XP or later: The $ prefix forces the keyboard hook to be used to implement this hotkey, which as a side-effect prevents the Send command from triggering it. The $ prefix is equivalent to having specified #UseHook somewhere above the definition of this hotkey. _________________ nick
denick @ http://de.autohotkey.com/forum/ |
|
| Back to top |
|
 |
dev Guest
|
Posted: Thu Jul 05, 2007 12:41 pm Post subject: |
|
|
Thanks! That works very well  |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|