How can I detect a key combination such as AltGr and special characters (I want to detect AltGr + ì, I have an Italian keyboard layout). Looking up online I came across SC combinations, which would be SC236, so I tried
<^>!SC236::send ~
Hotkeys can be triggered by using the hexadecimal virtual key (VK) code of a key
<^>!vkDD::send ~
in the rare case where a key has no name or the standard code doesn't work.
The virtual key code of such a key can be determined by following the steps at Special Keys. (On step 6 note the value in the first column of the list (VK)).
Related
So I have a working rebinder script, but the problem is when I want to display the rebinded keys names.
The code below returns the right names for a qwerty keyboard, but not for a azerty keyborad !
However, the bindings are correct, since the controls are working regardless of the keyboard layout. The only broken thing is the display, that is to say the value fed in the "UpdateText(string key)" void:
RebindSection[j].UpdateText(InputControlPath.ToHumanReadableString(
Actions[j].action.bindings[bindingIndex].effectivePath,
InputControlPath.HumanReadableStringOptions.OmitDevice));
Does anyone know how I can get the real name of the key and not the location of the key in us keyboard ?
Edit: I'm developing the game on ubuntu, And the script I wrote above works in the editor, but not in the builds...
To put it bluntly, the Unity Engine uses physical key signal to detect inputs from the keyboard, but as it's kinda hard to guess what an "0100100" keyboard signal means, it puts a QWERTY-based tag on the key's signals so that we, devs, can at least have an idea of what is going on.
The only kinda-problem that comes from this approach is the differential keys that exist between the 2 types of keyboards such as the "< >" key right to the left shift key that doesn't always exists on the QWERTY keyboard. (Most AZERTY keyboards has a small left shift key and a key in-between it and the W key with "<>" while most QWERTY keyboards just have a wide Left Shift key that covers both key at once.)
That's where the physical key kinda hits a snag as, in such case, the "<>" of the AZERTY keyboard key is actually just... absent on the QWERTY keyboard. Unity can register the key (as it does have its own unique signal), but that would make the key inaccessible on a QWERTY keyboard. Those kind of keys are called "White Keys" in development jargon which has a kinda rule to "Never use those by default unless it's for action available elsewhere. Leave it to the user to define those if possible.".
If you want the actual keyboard-based key name, you can access the key string with the following code:
Keyboard.current.KEYCODE.displayName
Replacing "KEYCODE" with the key name such as "aKey" which will give you the physical key located at "A" on a QWERTY keyboard based on your current keyboard language & layout.
I searched for hours but can't find a way to swap : with it's shifted key /. I am new to AutotHotkey. Can someone help me ?
colon key with slash (shifted)
Answer for the updated question from comments:
The layout is French AZERTY. The layout has a : key, and if it's shifted, it sends /. These should be swapped around so not shifting would send / and shifting would send :.
So the trick is to just send the other key, when other key is detected. Like so:
#UseHook
:::SendInput, /
/::SendInput, :
Using the keyboard hook #UseHook(docs) is important to make the hotkeys not trigger each other.
Normally this could be done with the $(docs) prefix, but due to bug in the syntax, $::: comes up as a syntax error.
Also, why couldn't the simple remapping syntax be used?
:::/
/:::
It's because the remapping syntax uses the blind sendmode(docs), which would cause the shift modifier to pass through and you'd always end up with the shifted variant of the key.
Technically you can use the remapping syntax for the first hotkey like this:
:::/
/::SendInput, :
This also wouldn't require you to use the keyboard hook, due to DownR(docs) being used in the remapping syntax.
Since we cannot use the typical remap sequence here (i.e. ::), we can instead use the Hotkey command to detect when the Colon is pressed, and then to remap it to a label
Hotkey, :, ColonDetected
return
ColonDetected:
Send, /
Answer based on this post in the AHK forums: https://autohotkey.com/board/topic/99092-remap-colon-key-help/
I have never been able to understand keybinding syntax well (bc it's hard to google if you don't know the name of a symbol to begin with!).
In DrRacket, I see bindings like "c:g" or "esc;g" .. I have tried hitting those keys in order to no avail. I have tried hitting them simultaneously. Nothing seems to work.
What do they mean? And, in general, how does one go about understanding this syntax?
A generic shortcut:
<modifier-key-1>:<key-1>;<modifier-key-2>:<key-2>;...;<key-n>
means:
press both <modifier-key-1> and <key-1> (that is: start pressing the modifier key, and while it is pressed, press key-1, then release both),
then, immediately, perform the same operation for the remaining combinations of keys,
finally, press <key-n>
Where the standard modifier keys are:
c - the control key modifier
s - the shift key modifier
m - the meta key modifier (not present in many keyboards)
a - the alt key modifier (sometimes already used to insert special characters)
(actually there are other key modifiers in different keyboards).
So, c:x;c:g;s:t means the following combination: Control-X, followed by Control-g, followed by Shift T (this insert Σ, the greek uppercase letter sigma in DrRacket), while c:x;c:g;s means Control-X followed by Control-G followed by the key s (insert the greek letter ς). Finally, the combination m-c-right means press both the modifier keys Meta and Control with the right arrow key.
When the meta modifier key is not present, it is often replace by the ESC (escape) key. Since this is not a key modifier, but a regular key, in this case it must be pressed and released before the next character. In other words, esc:g means: press the ESC key, release it, then immediately press the regular G key. esc-c-right means: press ESC, release it, then press C-→.
Moreover, when the ALT key is already used by the operating system to insert special characters, like in Mac OS X, it can be used as regular modifier key in DrRacket by setting a special preference (in Preferences > Editing > General).
In DrRacket you can find the current keybinding with the menu item: Edit > Keybindings > Show Active Keybindings, and you can find the relevant documentation here.
I am using the Japanese IME on Windows 10. TL;DR there is a shortcut to switch from alphanumeric (latin alphabet) to Japanese input. The combination is ALT+` [l or r alt + tilde key]. For it to work, both keys must be held down but the alt key must be pressed first. I am trying to bind this combination to one key.
I have been able to bind normal letter keys to a combination of other letters (e.g. a -> b + c) but I cannot get it to work with the keys I need, and especially not because there needs to be a delay between them. The code confuses me.
I use a German keyboard layout and I'm trying to move some keys around.
There is one physical key on my keyboard that has: ß, Shift+ß="?" and AltGr+ß="\", (in the US-layout is the - and Shift+-/kbd>="_" key).
I wish to move "ß" to AltGr+s, AltGr+ß="\" to "\" and disable AltGr+ß.
I tried this:
<^>!\::Return
<^>!s::Send ß
ß::Send \
This effectibly disables AltGr+ß="\" and makes ß input "\", but when I press AltGr+s it also inputs "\".
What I'm doing wrong?
I solved the problem after further trying:
ß::\
<^>!s::Send ß
<^>!ß::Return