Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

how to hold a key and spam it


  • Please log in to reply
4 replies to this topic
Angeli1992
  • Members
  • 25 posts
  • Last active: Feb 01 2012 07:58 AM
  • Joined: 05 Sep 2010
hi i want to know how do i make a script like
if i am holding space key and it spams space bar till i have hold down space key
thanks

MasterFocus
  • Moderators
  • 4323 posts
  • Last active: Jan 28 2016 01:38 AM
  • Joined: 08 Apr 2009
Spam space until you release it:
$Space::
  While GetKeyState("Space","P")
    Send, {Space}
Return
Spam space until you press it again:
$Space::
  KeyWait, Space
  While !GetKeyState("Space","P")
    Send, {Space}
  KeyWait, Space
Return
Study those and check the manual for further information.

-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

Antonio França -- git.io -- github.com -- ahk4.net -- sites.google.com -- ahkscript.org

Member of the AHK community since 08/Apr/2009. Moderator since mid-2012.


Angeli1992
  • Members
  • 25 posts
  • Last active: Feb 01 2012 07:58 AM
  • Joined: 05 Sep 2010
thank you both scripts are really helpful :D

Swirlly
  • Guests
  • Last active:
  • Joined: --
How would you make it when I hold down Ctrl it will repeatedly spam ctrl?
I found it for space, but I can't seem to make it work for Ctrl.

skylel
  • New members
  • 2 posts
  • Last active: Aug 19 2015 06:31 PM
  • Joined: 19 Aug 2015

Spam space until you release it:

$Space::
  While GetKeyState("Space","P")
    Send, {Space}
Return
Spam space until you press it again:
$Space::
  KeyWait, Space
  While !GetKeyState("Space","P")
    Send, {Space}
  KeyWait, Space
Return
Study those and check the manual for further information.

 

Where should i paste it? xDD