I'm trying to remap combination of insert and ' key. I know I can use asterisk for a single key but how do I use it for combination of two?
*insert & '::
SetKeyDelay -1
Send {Blind}{lwin DownTemp}
return
*insert & '::
SetKeyDelay -1
Send {Blind}{lwin Up}
return
this maybe give you answer:
https://www.autohotkey.com/docs/Hotkeys.htm#combo
Unlike a normal hotkey, custom combinations act as though they have the wildcard (*) modifier by default. For example, 1 & 2:: will activate even if Ctrl or Alt is held down when 1 and 2 are pressed
Related
RAlt::
Hotkey, a, label_a, On
return
RAlt Up::
Hotkey, a, Off
return
label_a:
Send, 1
return
and this
RAlt & b::Send hello
These two ahk codes don't work together. However, by having only one of those two, the script works.
Is there a way to make them work together?
The reason for this is that I also have alt shift combos ctrl alt shift combos etc.
Custom Combinations says:
For standard modifier keys, normal hotkeys typically work as well or
better than "custom" combinations. For example, <+s:: is recommended
over LShift & s::.
You had better use
>!b:: instead of RAlt & b::
>!>+a:: in RAlt-RShift combos
<!>+a:: in LAlt-RShift combos
etc.
See Hotkey Modifier Symbols in the documentation.
Here is a short AHK script which does two things:
Creates an extra Shift key on right alt (AltGr)
Redefines CapsLock as a function key, to be used to type extra characters.
#InputLevel 1
RAlt::RShift ; define shift on right-alt
SC03a::F20 ; define special function key on capslock
#InputLevel 0
F20 & SC002:: ; the '1' key
GetKeyState, sh, Shift
if sh = D
Send ¡ ; upside-down exclamation
else
Send ¹ ; superscript 1
return
It nearly works:
pressing AltGr plus 1 produces '!', as you would expect for a shifted key.
pressing CapsLock plus 1 produces '¹', as you would expect given the definition above.
The problem arises when you hold down both AltGr and CapsLock and press '1'. This produces '¡' as expected for the first character, but subsequent presses produce '¹'. It appears the Shift state gets magically cancelled after the first press.
Note, this doesn't happen with a "real" Shift key - Caps+Shift+1 produces '¡' every time, so it appears to be a problem with redefining another key to be Shift, where its shift state is cancelled after the first instance.
Am I missing something?
A while loop might be what you're looking for.
Example:
LShift::
while (GetKeyState("LShift", "P"))
{
SendInput, {¡}
Sleep, 100
}
return
I work with a hospital data entry system where no customization is allowed. I have found AutoHotKey to provide effective ways to work around the this system's "slow clunkiness".
What I need are more function keys on the keyboard. The best way I have found to approximate that is by remapping key pairs 1 Q:: Alt n, 2 w::ctrl r....ect. The best I could come up with was from AHK site's example and explanation of how to remap letter keys to other letter key destination. I tweaked and adjusted and came up with the following:
1 & q::
SetKeyDelay -1, 40 ;
Send {ctrl Down} ;
Send {Blind}{f Downtemp}
return
1 & q up::
SetKeyDelay -1 ;
Send {Blind}{ctrl up}
Send {Blind}{f Up}
return
This code will do the job but it has a downside. The first key in the sequence looses it's regular function. In this case, I've lost the use of my top row of numbers to become function keys. Is it possible to have the first key revert back to it's native function automatically after it was used in the key pair? I and the other pharmacy personnel will be most grateful for any help you can provide. Thank You.
Key combinations with & produce prefix keys. To restore a prefix key's original function, you need to define it explicitely:
1 & q::Msgbox, 1
1::Send, 1
+1::Send, {!} ; SHIFT + 1 may depend on your keyboard layout
However, it makes sense to arrange your key combinations in a way that produces as few prefix keys as possible. In your example, if you want to define hotkeys like 1 + q, 2 + q, 3 + q, and so on, it may be smarter to use q as the first key, leaving you with the necessity of redefining only one key:
SendMode, Input
q & 1::Msgbox, 1
q & 2::Msgbox, 2
q & 3::Msgbox, 3
q::Send, q
+q::Send, Q
; AltGr+q and CTRL+ALT+q also do something in Germany ;)
<^>!q::Send, #
^!q::Send, #
As you can see in the example, you always have to look out for keys that have a (usually third) functionality that's triggered by AltGr or CTRL+ALT. But this strongly depends on your keyboard layout.
Currently I must Ctrl & Tab to perform a traditional AltTab.
I've already swapped my Alt and Ctrl keys. However, I still want to be able to AltTab traditionally
This is what I have so far:
LCtrl::Alt
Alt::LCtrl
LCtrl & Tab::AltTab
LCtrl & Tab::Send {Alt Down}{Tab}{Alt Up}
Is the simple answer and will switch between the last 2 open windows.
If you want proper functionality, you'll have to read:
http://www.autohotkey.com/docs/commands/GetKeyState.htm
and use it in conjuction with
GetKeyState, OutputVar, LCtrl
If OutputVar = "D"
Send {Tab}
etc
This is works for me
LControl & Tab::AltTab
Is there a way to make a hotkey with a modifier that doesn't automatically put the modifier on the output key? ex: ^a::b -- except, when I hit ctrl+a it just gives me ctrl+b, when I just want ctrl+a to = b.
Playing a game which for some reason won't let me use hotkey ctrl + keys so I'm circumventing the issue by setting the hotkeys as something out of the way then setting the actual hotkey I want to those keys in autohotkey.
Try:
^a::
Send, b
Send, c
Send, d
Return
or
^a::Send, bcd
Could you show the exact text of line 4 that causes the error?