11
votes

I'm trying to use autohotkey to simulate elements of Mac keyboard on a PC (Windows) keyboard. My muscle memory reaches for the Command key for simple tasks like copying and pasting, so I'd like to remap the left alt+letter key combinations to appropriate ctrl+letter.

<!c::Send ^c

Most of the time it works fine, except for part of the time in IE and Office applications. When pressing the left Alt, it screws with the office ribbon/menus (i.e. the menu bar shows in IE, or ribbon letters start appearing in Office 2010), and the ctrl+letter combination fired does not reach destination.

I've read the AHK FAQ + forums, tried a couple of options with UP and $ modifiers to the hotkey, but it did not fix the problem. Any ideas?

7

7 Answers

14
votes

This prevents the left-hand side Alt key from activating the menu bar for most applications (under Windows 7 and AutoHotkey 1.1.11.01):

~LAlt Up:: return

It doesn't work with Internet Explorer but I don't use IE often anyway. :)

BTW, I also killed the annoying start menu popup via:

~LWin Up:: return
~RWin Up:: return
2
votes

Use

LAlt::LCtrl

put it into a ahk file compile it and run .exe with administrator rights

right click -> Run as administrator

I tested it on Windows 7 and it works, LAlt no longer fires anywhere and it is completely replaced with LCtrl.

2
votes

Just checked this on Win-7 and it works, even with IE.

00 00 00 00 00 00 00 00 03 00 00 00 1d 00 38 00 38 00 1d 00 00 00 00 00 00

Here is the SwapCtrlAlt.reg text.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,1d,00,38,00,38,00,1d,00,\
  00,00,00,00,00
1
votes

It sounds like you need the wildcard modifier. This will make it so if your hotkey is pressed in conjunction with another key. The mapping still works. Give the following a try:

*LAlt::LCtrl

This will make Alt fire Ctrl for any Alt+Key combination.

1
votes

Use

LAlt::LCtrl

this will replace LAlt with LCtrl

0
votes

you could also swap the two buttons.

Something like:

LAlt::LCtrl
LCtrl::LAlt

In the limited testing I did, it works, but you might need to relearn some of your window key shortcuts. It basically just swaps the two buttons.

0
votes

I am afraid that IE behaves differently from most other applications. You could try the instructions below. This is NOT autoHotKey but regedit changes. B.t.w. I had checked to see if ScanCodes would work (SC38 for LAlt), but IE still ignores that.

Not sure if this works in Vista/Win7/8, but worth a look.

http://www.designcodeexecute.com/2006/11/04/swap-alt-and-ctrl-keys-in-windows-xp/