Some key combos not working for AHK, some are Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Some key combos not working for AHK, some are

17 Aug 2017, 11:53

Hello, I have the following code as my sole .ahk file running. The goal is to have these key combinations work along with CapsLock(which is disabled). So "A & H::" means CapsLock held down, "A" held down, and "H" pressed. All of the following work perfectly except "S & Y::" -- notice "S & O::" is the same info being sent via SendInput and it works, so it is not anything with what is being sent. Here is the .ahk file code:

SetCapsLockState, AlwaysOff

#If GetKeyState("Capslock", "P")

S & Y::SendInput, {enter}Test{enter}Test 2{enter}
S & O::SendInput, {enter}Test{enter}Test 2{enter}

A & H::SendInput, 1234 West Street.{enter}New Orleans, LA 70309-0390
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

17 Aug 2017, 11:54

FYI, when I say CapsLock is disabled I mean it's normal function is turned off, thus turning it into a hotkey I can use for everything
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are

17 Aug 2017, 12:31

Your posted script works as is for me. Which leads me to believe there is a hotkey interfering elsewhere in your script, or maybe even a concurrent running script that is capturing the hotkey first.

If you have other S & Y hotkeys or just a Capslock & Y hotkey or a lone Y:: hotkey somewhere under the #If directive maybe that is conflicting, or maybe it's not under any #If. I personally wouldn't expect those to conflict in the same script, as technically I think the Caps+S+Y should be taking priority as more specific, but I could be wrong. What I could expect is if another script has those hotkeys, in which case the two AHK scripts don't communicate about which one should be taking priority - and I believe it'll be the most recently launched script that intercepts the hotkey first.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

17 Aug 2017, 12:42

Exaskryz wrote:Your posted script works as is for me. Which leads me to believe there is a hotkey interfering elsewhere in your script, or maybe even a concurrent running script that is capturing the hotkey first.

If you have other S & Y hotkeys or just a Capslock & Y hotkey or a lone Y:: hotkey somewhere under the #If directive maybe that is conflicting, or maybe it's not under any #If. I personally wouldn't expect those to conflict in the same script, as technically I think the Caps+S+Y should be taking priority as more specific, but I could be wrong. What I could expect is if another script has those hotkeys, in which case the two AHK scripts don't communicate about which one should be taking priority - and I believe it'll be the most recently launched script that intercepts the hotkey first.
Thanks, yeah it should work.

1. I have zero other .ahk files loaded at all. All of my Auto Hot Key work is done in one script.

2. The script is a bit larger than what I posted, but I didn't want to post things like my phone number. There is only one other place "Y" is used, and that is here:

E & Y::SendInput, email@domain.com

But that is within the CapsLock area just like "S & Y::"... and I have no other issues with the second letter (the third key) being the same as others as long as the key held before it is different.

There is no place at all where "Y" is used on its own with CapsLock

This is all very confusing! Oh, it is also happening with "S & F::"... same situation, "F" on its own with CapsLock is not assigned. But I figured I would be simple and post my "S & Y::" issue and it would solve the other if we found a solution

Thanks!
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

17 Aug 2017, 12:48

Here I'll make this super simple, this is a new .ahk file. These are ALL the contents of that file. There are zero other .ahk files running, I have quit Auto HotKey and ran this and only this:

SetCapsLockState, AlwaysOff

#If GetKeyState("Capslock", "P")

S & Y::SendInput, Test
S & Q::SendInput, Test


That's it, that is everything. "S & Y" does nothing, "S & Q" types "Test".
Helgef
Posts: 4709
Joined: 17 Jul 2016, 01:02
Contact:

Re: Some key combos not working for AHK, some are

17 Aug 2017, 12:57

I doesn't work for me either, maybe because of Key rollover.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are

17 Aug 2017, 13:06

I can confirm that this script works for me. Both three-key combinations produce "Test".

Code: Select all

SetCapsLockState, AlwaysOff

#If GetKeyState("Capslock", "P")

S & Y::SendInput, Test
S & Q::SendInput, Test
So maybe there's another program on your computer that interferes with particular key combinations. Or perhaps as Helgef said, it's how your keyboard/driver is designed that interferes for whatever reason.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

17 Aug 2017, 13:31

Exaskryz wrote:I can confirm that this script works for me. Both three-key combinations produce "Test".

Code: Select all

SetCapsLockState, AlwaysOff

#If GetKeyState("Capslock", "P")

S & Y::SendInput, Test
S & Q::SendInput, Test
So maybe there's another program on your computer that interferes with particular key combinations. Or perhaps as Helgef said, it's how your keyboard/driver is designed that interferes for whatever reason.
Any way to know if something is interfering? Like I mentioned "E & Y" works, "S & Q" works, but not "S & Y"
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

20 Aug 2017, 05:18

Hmmm... any ideas? Any way I can easily find out if something is blocking this? I do not have any other shortcut/macro software that would use "S" and "Y" together.

Note... this is happening in any place I wish to SendInput to... Notepad, Word, Outlook email, everything. So it is not like one program has a hot key itself that conflicts.

And note, I have one and only one AHK script running, ever.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

01 Sep 2017, 07:36

Grrr... I've tried everything... does anyone know of an over-arching application or anything that can tell me what programs could be trapping keys besides AHK?
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

04 Oct 2017, 09:03

I hate to bump this, but I cannot find anything blocking certain combos from firing n AHK and others not.

Any way to see if something is blocking my things from firing?

It is a complete mystery... they all involve caps lock (disabled in the AHK script, and thus open for usage in AHK).

Is there anything out there that shows what things may have a "hook" on certain key combos?
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

29 Oct 2017, 07:03

I feel kinda lonely with this topic, I am hoping someone has ANY idea.

I cannot figure it out at all. FYI, nothing including MsgBox fires for (a few key combos, specifically S & Y)

Note all of this comes after:
SetCapsLockState, AlwaysOff
#If GetKeyState("Capslock", "P")

But the confusing thing is, in this example: CapsLock plus: "E & Y" works, "S & Q" works, but not "S & Y"

So it's not like the first held character of "S" never works. As well the second typed character of "Y" does not work. They do in other cases.

There are a few combos (along with initially pressing the "disabled" CapsLock) that do not work for NO REASON AT ALL.

I am open to anything. I only have one .ahk script running, ever. It is very basic, it just has these combos with CapsLock. That is all. That is all I want... to have CapsLock be my main "macro key"... and have a bunch of combos for signatures, web addresses, emails, mailing addresses, etc.

I looked at the AHK logs, and they're not very verbose, but it is clear that some things are firing and others are ignored.

I am open to using any tool to see what could be causing this blockage. I cannot think of anything in the world that is running that would "take over" these specific key combos.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

29 Oct 2017, 07:20

FYI... I have closed every single application (even from Task Manager) that didn't seem to relate to my system (Win 10 Pro, FYI).

I've also played with running AHK as Administrator through multiple ways (compatibility mode on all EXE's, running the .ahk as Administrator)

Nothing.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are

29 Oct 2017, 08:06

I am imagining this is about the Key Rollover that Helgef shared. Inside that post by Helgef, there was a link to a page you can test the rollover at. What results do you get from it? The site is http://www.gigahype.com/nkey-rollover-test-page/

There are some 3-key combinations that fail for me, such as R+T+Y; the Y is ignored. I can't do E+R+T either; the T is ignored in that case.

I can do Caps+Q+S, but I cannot do Caps+Q+W. I can so Caps+A+W, but I cannot do Caps+A+S. The W and S will fail if it's paired with the key to its left on a standard QWERTY keyboard.

I'm thinking this is something fundamental to the keyboard and it's wiring, as stated in the comments by Helgef's linked forum topic.

A workaround if you are really wanting to use certain key combos would be a hotstring or just detecting consecutive input; you'd release the initial key(s) but it would fire afterward.

Alternatively, I would consider something like this to use CapsLock

Code: Select all

#If GetKeyState("CapsLock","T") ; this is T, not P
s & y::MsgBox Hello ; press together
::su:: ; press consecutively
MsgBox Hello 2
return
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

29 Oct 2017, 08:21

Exaskryz wrote:I am imagining this is about the Key Rollover that Helgef shared. Inside that post by Helgef, there was a link to a page you can test the rollover at. What results do you get from it? The site is http://www.gigahype.com/nkey-rollover-test-page/

There are some 3-key combinations that fail for me, such as R+T+Y; the Y is ignored. I can't do E+R+T either; the T is ignored in that case.

I can do Caps+Q+S, but I cannot do Caps+Q+W. I can so Caps+A+W, but I cannot do Caps+A+S. The W and S will fail if it's paired with the key to its left on a standard QWERTY keyboard.

I'm thinking this is something fundamental to the keyboard and it's wiring, as stated in the comments by Helgef's linked forum topic.

A workaround if you are really wanting to use certain key combos would be a hotstring or just detecting consecutive input; you'd release the initial key(s) but it would fire afterward.

Alternatively, I would consider something like this to use CapsLock

Code: Select all

#If GetKeyState("CapsLock","T") ; this is T, not P
s & y::MsgBox Hello ; press together
::su:: ; press consecutively
MsgBox Hello 2
return


I will look at this, but I am curious what you mean my "this is T, not P" in the GetKeyState for CapsLock? I tried replacing it with T and nothing works, and my key combos all are not trapped and thus are just typed as normal letters.
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are

29 Oct 2017, 08:34

T in the GetKeyState() function is about Toggle; it checks for CapsLock, NumLock, and ScrollLock to be active. You don't have to be holding the keys, which should avoid the rollover.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

29 Oct 2017, 08:40

Exaskryz wrote:T in the GetKeyState() function is about Toggle; it checks for CapsLock, NumLock, and ScrollLock to be active. You don't have to be holding the keys, which should avoid the rollover.
I see, but this does not work at all:
#If GetKeyState("CapsLock","T")

And this does:
#If GetKeyState("CapsLock","P")

(by "does" I mean I am still having some key combos not working, but most work. #If GetKeyState("CapsLock","T") does nothing for any combos with CapsLock. Note I disabled CapsLock with SetCapsLockState, AlwaysOff first.)
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are  Topic is solved

29 Oct 2017, 08:42

Oh yeah, if CapsLock is always Off, then GetKeyState("CapsLock","T") is going to always come back false. The workaround I'm suggesting would be letting CapsLock work as normal; you can set it so after running a combo key it turns CapsLock back off afterward.
downstairs
Posts: 42
Joined: 17 Aug 2017, 11:42

Re: Some key combos not working for AHK, some are

29 Oct 2017, 09:18

Exaskryz wrote:Oh yeah, if CapsLock is always Off, then GetKeyState("CapsLock","T") is going to always come back false. The workaround I'm suggesting would be letting CapsLock work as normal; you can set it so after running a combo key it turns CapsLock back off afterward.
I'm confused then. I tried what you suggested- taking my "always off" for CapsLock out, and I then need to toggle CapsLock on... take my finger off it, then press my two keys... and go back and turn CapsLock off again manually.

That's a lot of work compared to a three key combo....

Unless I am missing something in the code?
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Some key combos not working for AHK, some are

29 Oct 2017, 09:48

That's literally the idea.

If your keyboard will not support three simultaneous keys, then using one as a tap and the next two as a hold is the next best workaround.

If your keyboard literally cannot tell your computer/Windows that it is 3 keys held down and not just the first two (Because of the wiring), there's I imagine there's nothing that can be done to make the keyboard work short of rewiring it and coming up with a new keyboard driver. It was mentioned that some gaming computers come with better wiring that won't ignore key presses when multiple keys are down, because some games require a lot of simultaneous input.

I haven't watched this video yet (and will in a moment when football goes to halftime), but this looks like it'll be a great video to learn from:

https://www.youtube.com/watch?v=kOkV9BalNcw

Edit: Nah, that video wasn't as helpful as I hoped. Probably because they focused a bit more on gaming rather than someone trying to use AHK or other custom key combination software.

But one comment helped demonstrate something:
open notepad, hold both shift keys while typing "the quick brown fox jumped over the lazy dog". have a lot of missing letters? you have a cheap keyboard, buy something better.
I only get THKBNFJDTHLAYDG doing that.

But the video does suggest one viable solution is to just get a new keyboard; a new keyboard driver may not be necessary (but a new keyboard may install a new driver.)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 130 guests