0

I searched past questions, but I haven't found a solution to switch LAlt with LCtrl (or CapsLock with LCtrl) while preserving completely AltGr, that corresponds to Ctrl+Alt (or maybe LCtrl+RAlt?).

This is the closest question, but I cannot use Registry, I have limited privileges. Switch Ctrl and Alt with AutoHotKey without messing up the Alt-Tab switcher?

Also related: https://code.google.com/p/uawks/issues/detail?id=2

I'm using either of these simple scripts:

LAlt::LCtrl
LCtrl::LAlt

Second one:

LCtrl::CapsLock
CapsLock::LCtrl

Whenever I press AltGr with any other key, something get stuck and I have to press randomly Alt, Ctrl until I can write again. If I use the second script, CapsLock gets activated!

My keyboard is Swiss and I have a lof of keys with a third symbol, therefore I need often AltGr, remapping each one would not be a clean solution.

Update

I just found out that the issues with AltGr are completely solved by adding the following line at the end of the two scripts previously posted, but I don't understand why this is happening.

<^>!::RAlt

Why is the remapping of AltGr as RAlt ALONE still producing the effect of a regular AltGr?

0

1) While simple in nature, the logic of this post is difficult to follow for those of us without an AltGr keyboard to just go test with. I speak for myself at any rate... for comprehension sake, it may help to clarify which two line script you are talking about, followed by a list of what keys you press (and in what order), followed by a list of what results you get. Then list the next script, keys and results. Or maybe others don't need this, but it was a bit difficult for me to follow even though I believe you have all the critical information listed.

2) Have you looked at hotkey reassignments in the help files? I noticed two things you may want to play with. First is the use of * as a modifier. Second is the use of 'Up' to trigger on an upstroke to send a different upstroke (i.e., send an upstroke for a different modifier). Look at the LWin redefinition listed under Hotkeys in the help file:

*LWin::Send {LControl Down}
*LWin Up::Send {LControl Up}

3) Things get stuck sometimes and when that happens you can sometimes work around it by sending 'Up' commands even if the key is already up. Technically it may not be needed, but sometimes it works (and sometimes it doesn't).

4) It may (or may not) serve to look in the key history list via the View menu. Often you can find why things get stuck or why they misfire by looking at the order keys are processed in (i.e., the order they are listed in) and whether or not they are ignored due to the various reasons listed.

5) As the LWin redefinition example shows, you may want to use 'Send' or 'SendInput' command for more flexibility during troubleshooting (if you don't wind up needing it of course you can go without and make the code cleaner, but it doesn't hurt anything). For example, using a Send command makes it easy to tack another character or keystroke onto a single hotkey reassignment, then look at the firing order in the key history list to see what it thinks was pressed and in what order.

If I had one of these keyboards to test with I would probably take one of the two-line examples you listed and turn it into a four-line key reassignment, in the manner of the LWin reassignment example, then look at what's happening in the key history. I might add a pause statement too, in order to catch it in the act and be able to look at the keystroke history right up to the point where the pause got executed, which would exclude the log from showing any modifier keys getting released.

I have no idea if this would work, but here's an outline of the type of thing you might start with for debugging purposes.

*LAlt::Send {LCtrl Down}
*LAlt Up::Send {LCtrl Up}
*LCtrl Up::Send {LAlt Up}
*LCtrl::
     Send {LAlt Down}
     Pause   ; once the script is paused you can go look at Key History
 Return

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.