How to have key function as normal but send an extra key on release?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
JerryTheGnome
Posts: 10
Joined: 26 Apr 2016, 14:54

How to have key function as normal but send an extra key on release?

17 Nov 2019, 14:10

Hey,

I would like to be able to press the j key in my video editor, have it perform normally as the j key would if physically pressed and released.
But also on it's release after a small delay (say 200ms) tap the Left Alt key (like press down and release as if you were physically doing it).

Any help would same me so much pain in the ass editing.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: How to have key function as normal but send an extra key on release?

17 Nov 2019, 14:39

Try:

Code: Select all

#NoEnv

~j::return

j Up::
    Sleep 200
    Send, {LAlt Down}
    Sleep 50
    Send, {LAlt Up}
return
JerryTheGnome
Posts: 10
Joined: 26 Apr 2016, 14:54

Re: How to have key function as normal but send an extra key on release?

18 Nov 2019, 03:29

For some reason LAlt seems to be bugged here. It presses it on release but never appears to release it. If I use a normal key like k then it does press and release it correctly? Bit strange.
JerryTheGnome
Posts: 10
Joined: 26 Apr 2016, 14:54

Re: How to have key function as normal but send an extra key on release?

18 Nov 2019, 03:34

Not sure but I think this thread covers the same problem: https://autohotkey.com/board/topic/27064-alt-key-sticking/
This seems to be the official notes on it, but not sure how to implement it: https://www.autohotkey.com/docs/commands/_HotkeyModifierTimeout.htm
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: How to have key function as normal but send an extra key on release?

18 Nov 2019, 05:34

Works fine here not sure why it wouldn't work.
I don't think those links apply.
Have you tried running only this as a script?
JerryTheGnome
Posts: 10
Joined: 26 Apr 2016, 14:54

Re: How to have key function as normal but send an extra key on release?

19 Nov 2019, 16:17

Actually the issue is that sometimes the j key doesn't release? It gets locked down until it is pressed again. Any ideas to make sure that it knows to be released?
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: How to have key function as normal but send an extra key on release?

19 Nov 2019, 18:04

Try this:

Code: Select all

#NoEnv

~j::return

~j Up::
    Sleep 200
    Send, {LAlt Down}
    Sleep 50
    Send, {LAlt Up}
return

4A 024 h d 2.39 j
4A 024 h u 0.13 j
A4 038 i d 0.20 LAlt
A4 038 i u 0.06 LAlt
Should be good now.
JerryTheGnome
Posts: 10
Joined: 26 Apr 2016, 14:54

Re: How to have key function as normal but send an extra key on release?

20 Nov 2019, 02:56

Also just wondered if the up and down is substituted for SendInput, {LAlt} what is the difference, api says that is new version or something?
Also how do I tie this specifically to premiere pro so it only works when that process is working or focused? had a look and seems #ifwinactive is way to do it but not sure how to correctly implement.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: joedf, OrangeCat, scriptor2016, supplementfacts and 132 guests