Ctrl Function behaves as permanently activated Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rodrigopcstro
Posts: 2
Joined: 16 Aug 2022, 17:49

Ctrl Function behaves as permanently activated

Post by rodrigopcstro » 16 Aug 2022, 18:42

I maped the [Ctrl Key] to the [CapsLock Key], because I believe it's more ergonomic, and the [Ctrl Key] still works the Ctrl Function. I don't use the CapsLock Function that often, so I maped it to [Alt Gr Key] + [CapsLock Key]. To do so, I'm using the following script:

Code: Select all

<^>!CapsLock::CapsLock ; AltGr+CapsLock returns CapsLock
CapsLock::Ctrl ; CapsLock returns Ctrl
Now, every time I want to access the task manager by Ctrl + Shift + Esc i get the following:
1 - If I use [Ctrl Key] + [Shift] + [Esc], I get what I want without any bugs;
2 - If I use [CapsLock key] + [Shift] + [Esc], the computer behaves as if the Ctrl Function was permanently activated, and in order to deactivate it I need to press the [CapsLock Key] or [Ctrl Key]

The behavior described in item 2 doesn't happen only with the task manager shortcut, but this is the only one I could reproduce. If I deactivate the script, the problem goes away. I would like to know if this is a problem with my script and how I can fix it. Thanks in advance.

Notebook: Acer Aspire A514-54G
AutoHotkey version: v1.1.34.03.

Rohwedder
Posts: 7627
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Ctrl Function behaves as permanently activated

Post by Rohwedder » 17 Aug 2022, 07:54

Hallo,
try:

Code: Select all

<^>!CapsLock::SetCapsLockState,% GetKeyState("CapsLock","T")?"Off":"On"
CapsLock::RCtrl ; CapsLock returns Ctrl

wetware05
Posts: 750
Joined: 04 Dec 2020, 16:09

Re: Ctrl Function behaves as permanently activated

Post by wetware05 » 17 Aug 2022, 09:01

Very ingenious, Rohwedder :thumbup: and almost everything in the same line. What do the <^> signs do? It's the first time I see them.

gregster
Posts: 9002
Joined: 30 Sep 2013, 06:48

Re: Ctrl Function behaves as permanently activated

Post by gregster » 17 Aug 2022, 09:04

wetware05 wrote:
17 Aug 2022, 09:01
What do the <^> signs do? It's the first time I see them.
Generally, < and > stand for left and right versions of a modifier key. In this case, though, it's about the AltGr key (which is not available on all keyboard layouts), which is equivalent to LCtrl and RAlt.
https://www.autohotkey.com/docs/Hotkeys.htm#AltGr

rodrigopcstro
Posts: 2
Joined: 16 Aug 2022, 17:49

Re: Ctrl Function behaves as permanently activated  Topic is solved

Post by rodrigopcstro » 17 Aug 2022, 13:40

Rohwedder wrote:
17 Aug 2022, 07:54
Hallo,
try:

Code: Select all

<^>!CapsLock::SetCapsLockState,% GetKeyState("CapsLock","T")?"Off":"On"
CapsLock::RCtrl ; CapsLock returns Ctrl
Rohwedder, Thanks for the suggestion. Unfortunately your script didn't solve the problem, but I was able to discover, with the help of this thread viewtopic.php?t=15364, that running my original script as administrator seems to solve the issue.

Since I set up windows to run my script on startup, I just need to discover how to do the same as administrator.

Post Reply

Return to “Ask for Help (v1)”