Make AutoHotKey ignore Alt as menu key

ⅰ亾dé卋堺 提交于 2019-12-04 08:31:37

问题


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?


回答1:


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:


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.




回答3:


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



回答4:


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.




回答5:


Use

LAlt::LCtrl

this will replace LAlt with LCtrl




回答6:


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.




回答7:


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/



来源:https://stackoverflow.com/questions/13934711/make-autohotkey-ignore-alt-as-menu-key

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!