Remapping keys only one time in AutoHotkey - autohotkey

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

Related

Re-enable right-Ctrl when using Canadian Multilingual Standard keyboard for my AutoHotkey function?

I have an Autohotkey function that lets me switch between tabs with "Control + left/right" as well as closing tabs (Ctrl-down) and going into the search bar (Ctrl-up). It helps me save clicks and use the mouse less.
However, I use the Canadian Multilingual Standard keyboard to type accents (éèçà) in French for some of my classes and this keyboard DISABLES the right control key (the one right beside my keyboard buttons) which is the most convenient to use with my right hand only.
Here is a source documenting this: http://archives.miloush.net/michkap/archive/2013/04/08/10409187.html
Is there any way I can override this? I very rarely use the letter œ for because I can just use ALT + 0156 instead.
Here is the very simple code for my hotkey!
^Left::SendInput, ^{PGUP}
^Right::SendInput, ^{PGDN}
^Up::SendInput, !d
^Down::SendInput, ^w
Using SciTE4AutoHotkey tool, on my UK hardware keyboard right ctrl is detected as expected (RControl)
When I switch to French (Canada) Canadian Multilingual keyboard,
the right ctrl key is not found, also Virtual Key is different: DF
(SC means scan code and VK means virtual key)
so if you remap, it should solve the problem
~SC11D::RControl
After remapping: not found is replaced by RControl with each keypress.
Even if above remapping does not work for your case, it is a matter of finding which key corresponds to relevant scan code and then you can remap it.
Double click on your ahk script on the taskbar, and then
View > Key history and script info (Ctrl + K) by pressing key and refresh(F5) you can see respective keyboard scan codes.

AutoHotKey replace dollar sign with percent

I'm trying to use Auto Hot Key to replace $ with %. I also am replacing & with $.
My problem is that when I press the & key (now remapped to $), it thinks I'm actually pressing $, so it triggers the code and types %.
This is the code:
~::#
#::?
%::^
^::~
$::Sendraw `%
&::$
?::+
/::_
+::&
=::/
_::=
My keyboard layout doesn't have these keys as actual keys, so I can't really test this for you, but I can still tell you what will likely fix the problem, and then an other version which will definitely fix the problem.
So the thing that will likely fix the problem is using the $ modifier (docs). You should only need it for the $::Sendraw `% hotkey, because the other hotkeys use the remapping syntax and will automatically do what adding the $ does.
So your script would look like this:
~::#
#::?
%::^
^::~
$$::SendInput, `%
&::$
?::+
/::_
+::&
=::/
_::=
(and I also switched to using SendInput because SendRaw really made no sense there)
That should work if all the hotkeys are as actual keys on your keyboard layout (as opposed to being accessible with modifier key combos (e.g. CTRL + ALT + 2), like they are on my keyboard layout).
Why it wouldn't work when having to mess with modifiers keys is a bit more complicated. I can explain it in detail if you're actually interested, but for now I'll just say it's because of the blind send mode the remapping syntax uses.
So, not using the remapping syntax like this should ensure it'll work on any keyboard layout no matter what:
*~::SendInput, #
*#::SendInput, ?
*%::SendInput, {^}
*^::SendInput, ~
*$::SendInput, `%
*&::SendInput, $
*?::SendInput, {+}
*/::SendInput, _
*+::SendInput, &
*=::SendInput, /
*_::SendInput, =
Here we're using the * (docs) modifier to deal with having to hold modifier keys to access hotkeys. And we're not using $ modifier, because using * already does what $ does. So having them both would be redundant.
+4::SendInput, `%
This should work fine.

Cannot insert tilde in Eclipse for C/C++

In Eclipse for C/C++ on Windows 10, I cannot insert the tilde symbol '~' which works fine in other applications.
I'm on a french keyboard, so I type Alt Gr + '~' to access it ('~' key is also the one for 'é' and '2').
I saw similar problems with curly braces or asterisks, resolved by deactivating a given shortcut, but I saw none for tildes.
I searched in the shortcuts of eclipse, but found none using '~' key with alt gr (even none with '~' key and alt or ctrl or something else).
Thank you in advance
By typing Alt+keys 0 to 9 from numeric pad to compose values from 1 to 255 or 0128 to 0255 (list of codes and corresponding characters), it's possible to enter a few characters which are not available on the keyboard:
~ : use Alt+126
` : use Alt+96
I found a solution that works for me on my Turkish Q layout, in which AltGr+ü produces tilde. It is to create a new keyboard layout and remove the dead key attribute from this key, which has the added benefit of removing this annoying "feature" of requiring two key presses to get these symbols. A detailed solution is at: https://superuser.com/a/414415/351077
Somehow the language tray icon displays the wrong language ("ENG") for the newly created layout even though the properties in the layout editor are correct, but I don't mind.

Bind keyboard shortcut to one key in AutoHotkey with delay

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.

Typing the tilde ~ character in DOS

In my DOS prompt I have to put in a tilde (~) character to open any files.
For some reason it won't show up in the DOS box/prompt.
Is there any form of Ctrl shortcut key thing that could get me to typing a ~ character?
It's only the DOS prompt that won't recognize that key is what gets me the most though.
Hold down the Alt key and type 0126 (zero one two six) on the numeric keypad. That is the ascii value of that character.
GWBasic:
10 a$="~"
20 ? asc(a$)
run
126
In DOS you need to begin with a 0 + value you need for other symbols and it only works on the numeric keypad.
On Spanish keyboards you can press "Alt Gr" and "4".
That key combination will write a tilde anywhere, including the command line.
How about trying to copy/paste it?
Start->Run->charmap
select the ~ char and hit select then copy
open the prompt window and go Alt+Space then Edit->Paste
I typed SHIFT and the "key left to the digit 1" to produce a tilde ~ in my multimixed system.
(This actually worked. Actual keyboard is de-sg, but the multiemulated environment behaves like a DOS or WinPE US keyboard, in a command window.)