0

(Not sure how to edit the script for it to become readable on StackExchange)

If a letter has modifiers and is being sent on this double press script from SetTimer on the manual (https://www.autohotkey.com/docs/commands/SetTimer.htm), the triggering key`s preceding modifier(s), in this case shift, will be included on the letters along with any existing ones already on the letter. With the script bellow, F is being sent because shift is being added to ^A for some reason. This does not appear to occur with numbers or keys that need to be inside of { }, such as {F1}. Any clue?

; Testers:
+^A:: Send, F
^A:: Send, T

+^B:: Send, F
^B:: Send, T

; Malfunctioning double press:

+PGDN Up::
if (SHIFTPGDN_presses > 0)
{
SHIFTPGDN_presses += 1
return
}
SHIFTPGDN_presses := 1
SetTimer, KeySHIFTPGDN, -300
return

KeySHIFTPGDN:
if (SHIFTPGDN_presses = 1)
{
Send, ^A
}
else if (SHIFTPGDN_presses = 2)
{
Send, ^B
}
SHIFTPGDN_presses := 0
return

  • FYI, you can put 4 spaces in front of each line of code to make it appear in a separate block of recognizable code on StackExchange – JJohnston2 Jun 22 at 4:46
  • Thanks for the editing tips. Found the mistake also: A is +a not only while typing, but also while sending keys, so I just needed to put ^a and ^b instead. – Five One Jun 27 at 16:31
0

Not sure exactly what's happening, but you can try using SendInput or SendMode Input (sometimes has slight differences with Send / SendPlay).

Another command you can try is KeyWait, which can be used to wait until the original modifier is let up. That may not have the desired effect though as it induces a delay until you let off the modifier.

Another thing you can try is to send the actual modifier up, such as Send {Shift Up} or Send {Ctrl Up}. This can also introduce issues in certain cases but can also be helpful sometimes depending on what you're doing.

And if you're trying to trigger a hotkey from another hotkey, you may need to look at SendLevel (I don't think you're doing that from a quick glance at your code, but just FYI).

  • Thanks for the editing tips. Found the mistake also: A is +a not only while typing, but also while sending keys, so I just needed to put ^a and ^b instead. – Five One Jun 27 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.