how to: hold key up until release command is given

Ask gaming related questions (AHK v1.1 and older)
thankyou
Posts: 5
Joined: 23 Jan 2018, 19:17

how to: hold key up until release command is given

23 Jan 2018, 21:01

i need a simple command to hold up a key (in this case shift ). and keep it in the up position until i give another command to stop holding it up

im going to be holding the key(shift) down manually the entire time, so i need this command to ignore my own key(shift) press, while it performs an action without shift, then resume my own key(shift) input when i say so.

i tried
++Lbutton::
send {shift up}
click
send {shift down}
return

but it only turns off shift for a split second.
GreatGazoo
Posts: 69
Joined: 28 Dec 2017, 02:53

Re: how to: hold key up until release command is given

23 Jan 2018, 23:22

https://autohotkey.com/docs/commands/BlockInput.htm

you could try block input which ignores your keys while it does it's thing so you don't interrupt the flow of the script

Code: Select all

 
^!p::
KeyWait Control  ; Wait for the key to be released.  Use one KeyWait for each of the hotkey's modifiers.
KeyWait Alt
BlockInput On
; ... send keystrokes and mouse clicks ...
BlockInput Off
return
icuurd12b42
Posts: 202
Joined: 14 Aug 2016, 04:08

Re: how to: hold key up until release command is given

24 Jan 2018, 04:58

You need to run the script in administrator mode for blockinput to work

switching the send to SendInput may be enough to work:

https://autohotkey.com/docs/commands/Send.htm#SendInput

"SendInput and SendPlay [v1.0.43+]: SendInput and SendPlay use the same syntax as Send but are generally faster and more reliable. In addition, they buffer any physical keyboard or mouse activity during the send, which prevents the user's keystrokes from being interspersed with those being sent. SendMode can be used to make Send synonymous with SendInput or SendPlay. For more details about each mode, see SendInput and SendPlay below."

I use
SendMode Input
which makes send work like it...

these setting I use all the time placing them at the top of every one of my projects
#NoEnv
#InstallKeybdHook
#InstallMouseHook
#UseHook On
#SingleInstance FORCE
#Warn ALL
#Persistent
SendMode Input

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 137 guests