0

我有一个 AutoHotKey 脚本,它询问我是否要将我的 Win 键重新映射到 Ctrl 或取消它们的重新映射,从而再次使它们成为 Win 键。

但是我找不到取消重映射的方法。如果我使用该命令LWin::Lwin,我会收到错误消息,即存在“重复键”。

我是 AutoHotKey 的新手,但我先搜索过,所以请不要咬我的头,这是一个愚蠢的问题。(这是一台装有 Windows7-64 的联想笔记本电脑)。

这是脚本:

MsgBox, 4, , Remap CTRL for Desktop Keyboard?
IfMsgBox, Yes
   LWin::LCtrl
   RWin::RCtrl
   return
; Otherwise, the user picked No
;   LWin::LWin
;   RWin::RWin
;   return
4

2 回答 2

1

各种方式。

创建一个热键来关闭 ahk,例如^!x::ExitApp= [Ctrl]+[Alt]+[x]

创建一个热键以禁用/启用所有热键,例如f12::suspend

创建仅适用于特定应用程序的热键。

以下是所有建议的组合。一般情况下:LWin::LCtrlRWin::RCtrl都是活动的,除非你按了F12。您可以在 AHK_L 中设置可在 中使用的变量,您可以在#If (Var = 1)其中定义仅在该变量设置为 1 (true) 时才起作用的热键。

SetTitleMatchMode, 2 ; Allow the use of a portion of the wintitle
F12::
Suspend
If A_IsSuspended
    TrayTip, HotKeys, Off, 3, 0
Else
    TrayTip, HotKeys, On, 3, 0
Return

^!x::ExitApp
LWin::LCtrl
RWin::RCtrl
F1::MsgBox, Normal Mode

#IfWinActive, Window title
  F1::MsgBox, Window X is active
  F2::MsgBox, You pressed F2 inside Window x
#IfWinActive

Toggle := False
F10::Toggle := !Toggle ; Turns Mouse button ON|Off
#if Toggle ; ONLY worls in AHK_L
     LButton::Return ; Disables Mouse button
#if
于 2013-04-09T17:28:50.910 回答
-1

这是您可以从命令行驱动的版本:

; Allow the script to be reloaded multiple times
#SingleInstance force

; Check the command line for input
NumberOfParameters = %0%

; If any command line param was passed then just unload the mappings
If ( NumberOfParameters > 0 )
{
  MsgBox Command line parameter was passed, unloading...
  ExitApp
}
Else
{
  ; Let's ask the user what they want to do
  MsgBox, 4, , Remap CTRL for Desktop Keyboard?

  IfMsgBox, Yes
  {
    ; If yes, then remap
    MsgBox Keys have been mapped.
  }
  Else
  {
    ; If no, then unload
    MsgBox Unloading mapping.
    ExitApp
  }
}

; Keys will be mapped so long as the script remains resident
LWin::LCtrl
RWin::RCtrl
于 2015-03-02T02:12:51.417 回答