I know i can bind it to like f21 and bind that but are there better ways ?
[Mod action: Moved topic to gaming section.]
Disable caps lock caps functionallity while being able to bind it ingame
Re: Disable caps lock caps functionallity while being able to bind it ingame
Welcome to this AutoHotkey forum!
No. Binding it is the best way to bind it!
No. Binding it is the best way to bind it!
Code: Select all
#Requires AutoHotkey v2.0
game := 'ahk_exe game.exe'
; game := 'ahk_exe notepad.exe'
CapsLock:: {
If WinActive(game)
Send 123
}
Re: Disable caps lock caps functionallity while being able to bind it ingame
Hi. I'm piggybacking on this older thread, rather than start a new one pretty much the same question... I hope that's ok....
I am still using AHK 1.1. I would like to completely disable my caps lock key.
I don't want to bind its functionality elsewhere.
I don't want to assign any other key to it.
I want it to do nothing at all.
I keep hitting it by accident, and the LED on the key does not work, so I can't even tell if it is on. I'd rather have it do nothing at all.
I have tried binding it to itself (CapsLock::CapsLock), but that doesn't work.
I've tried binding it to (CapsLock::Esc), and that works often enough, but there are cases where accidentally sending an ESC creates more problems than accidentally switching to caps.
I tried CapsLock::Null but AHK didn't compile.
Any clues?
Thank you!
I am still using AHK 1.1. I would like to completely disable my caps lock key.
I don't want to bind its functionality elsewhere.
I don't want to assign any other key to it.
I want it to do nothing at all.
I keep hitting it by accident, and the LED on the key does not work, so I can't even tell if it is on. I'd rather have it do nothing at all.
I have tried binding it to itself (CapsLock::CapsLock), but that doesn't work.
I've tried binding it to (CapsLock::Esc), and that works often enough, but there are cases where accidentally sending an ESC creates more problems than accidentally switching to caps.
I tried CapsLock::Null but AHK didn't compile.
Any clues?
Thank you!
Re: Disable caps lock caps functionallity while being able to bind it ingame
Thank you for that nearly instant reply!
That works. It has an interesting effect. If I just press the caps key, it does nothing. But if I press and hold the key and then type another key, it toggles the caps function. Is that a byproduct, of the method being used, or somehow part of the design?
It's actually kind of useful, though there is some risk of accidentally switching into all caps. Not a bad tradeoff, though. Interesting!
Thanks again!
That works. It has an interesting effect. If I just press the caps key, it does nothing. But if I press and hold the key and then type another key, it toggles the caps function. Is that a byproduct, of the method being used, or somehow part of the design?
It's actually kind of useful, though there is some risk of accidentally switching into all caps. Not a bad tradeoff, though. Interesting!
Thanks again!
Re: Disable caps lock caps functionallity while being able to bind it ingame
It depends on what else is in your script. If you close all scripts but run a script with that individual hotkey, you might not see that behavior.
It works here. You can use #HotIf to create other contexts that enable the key.
Code: Select all
#Requires AutoHotkey v2.0
SetCapsLockState 'AlwaysOff'
CapsLock::Return
Re: Disable caps lock caps functionallity while being able to bind it ingame
Interesting. There ARE other scripts/commands in the .ahk file that I've placed this commands. Maybe if I make it the last item in the file? I will experiment!
Thank you!![Bravo! :bravo:](./images/smilies/bravo.gif)
Thank you!
![Bravo! :bravo:](./images/smilies/bravo.gif)
Re: Disable caps lock caps functionallity while being able to bind it ingame
What is a script? A script is simply a plain text file with the .ahk filename extension containing instructions for the program. That sentence comes from the documentation.
AHK is an event-driven program. This means that a hotkey is triggered by an event (e.g., you press the key), regardless of where the hotkey is in your script. Well, the order can matter if you have variants or specific contexts, but otherwise, just moving a hotkey will not necessarily change whether the hotkey is triggered, and that is part of the point of AutoHotkey.
The issue with your script is (probably) not the order of hotkeys but what each hotkey subroutine contains, or what contexts you have defined for them.
A hotkey for CapsLock is not a hotkey for a custom combination that includes CapsLock, and is not a hotkey for CapsLock that also includes a modifier key. It is also not a hotkey for CapsLock that falls under a different context as defined by #HotIf. When any of those other hotkeys exist, they will be triggered as distinct hotkeys if their context is active.
AHK is an event-driven program. This means that a hotkey is triggered by an event (e.g., you press the key), regardless of where the hotkey is in your script. Well, the order can matter if you have variants or specific contexts, but otherwise, just moving a hotkey will not necessarily change whether the hotkey is triggered, and that is part of the point of AutoHotkey.
The issue with your script is (probably) not the order of hotkeys but what each hotkey subroutine contains, or what contexts you have defined for them.
A hotkey for CapsLock is not a hotkey for a custom combination that includes CapsLock, and is not a hotkey for CapsLock that also includes a modifier key. It is also not a hotkey for CapsLock that falls under a different context as defined by #HotIf. When any of those other hotkeys exist, they will be triggered as distinct hotkeys if their context is active.
Re: Disable caps lock caps functionallity while being able to bind it ingame
Well for the last few weeks I've been running a script where the only only thing in it is:
This works at first, where pressing the CapsLock key does nothing at all. But sooner or later something happens where it gets defeated, and everything is typed in capitals, though pressing the CapsLock key continues to have no effect. The capslock key ends up effectively locked in on state, and the way to get out of this is to exit the script so the key can be used as normal.
I'm not sure what causes it to no longer work. It seems as though it might be some accidental key combination, where I'm unintentionally pressing the caps lock key at the same time I'm pressing another key, or there is an overlap of the two key presses, that somehow causes the CapsLock key to go into its On state, even as pressing capslock continues to not do anything. Not really sure, but it kind of seems like something like that is happening.
As is probably obvious, this is all at the limits of my understanding of how AHK works. But I'm hoping there might be a variation of this code that might be more robust and foolproof. I'm still using AHK v1 for now.
Code: Select all
CapsLock::Return
I'm not sure what causes it to no longer work. It seems as though it might be some accidental key combination, where I'm unintentionally pressing the caps lock key at the same time I'm pressing another key, or there is an overlap of the two key presses, that somehow causes the CapsLock key to go into its On state, even as pressing capslock continues to not do anything. Not really sure, but it kind of seems like something like that is happening.
As is probably obvious, this is all at the limits of my understanding of how AHK works. But I'm hoping there might be a variation of this code that might be more robust and foolproof. I'm still using AHK v1 for now.
Re: Disable caps lock caps functionallity while being able to bind it ingame
If you accidentally press Shift+CapsLock while that script is running, then you will still be able to turn caps on because that key combination is not blocked. You should be able to turn it off again by pressing Shift+CapsLock again.
If you want to also block Shift+CapsLock, then add that hotkey as well:
Or you can bock all modifier keys with CapsLock by using the wildcard modifier symbol:
If you want to also block Shift+CapsLock, then add that hotkey as well:
Code: Select all
CapsLock::return
+CapsLock::return
Or you can bock all modifier keys with CapsLock by using the wildcard modifier symbol:
Code: Select all
*CapsLock::return
Re: Disable caps lock caps functionallity while being able to bind it ingame
Thank you!.
That's definitely what was happening, I was pressing the shift key at the same time, locking it into the shifted On state. Basically, that is a variation of the very typo I am trying to make impossible to type, by defeating the bleeping CapsLock key.
I've now set it to
And it appears all is well. Makes perfect sense that I would need to set if for all modifiers. Though I had no idea that an asterisk could be used as a wildcard for all modifiers.
Thanks again. And thanks again to mikeyww for the original solution!
That's definitely what was happening, I was pressing the shift key at the same time, locking it into the shifted On state. Basically, that is a variation of the very typo I am trying to make impossible to type, by defeating the bleeping CapsLock key.
I've now set it to
Code: Select all
*CapsLock::Return
Thanks again. And thanks again to mikeyww for the original solution!
Who is online
Users browsing this forum: No registered users and 7 guests