完善 AutoHotkey 脚本

完善 AutoHotkey 脚本

该脚本的目的是:

  1. 前两排热键始终有效。
  2. 其余热键NO TEXT INPUT仅在状态下有效。换句话说,当屏幕上任意位置的小垂直线闪烁并等待输入文本/数字时,按zxasq,效果等同于正常原始字母。

我怎样才能做到这一点?

Rwin::^space 
AppsKey::^w 

CapsLock::MButton 

z::PgUp 

x::PgDn 

*a up::send {shift up}{ctrl up}{LButton up}

*a:: 
GetKeyState, LButtonState, LButton ; 
if LButtonState = U ; 
send {shift down}{ctrl down}{LButton down} ; 
return 

*s up::send {shift up}{ctrl up}{RButton up} 

*s:: 
GetKeyState, RButtonState, RButton ; 
if RButtonState = U ; 
send {shift down}{ctrl down}{RButton down} ; 
return 

*q up::send {shift up}{ctrl up}{MButton up} 

*q:: 
GetKeyState, MButtonState, MButton ; 
if MButtonState = U ; 
send {shift down}{ctrl down}{MButton down} ; 
return

答案1

您可以通过查看来检测当前显示的光标类型A_Cursor

A_Cursor 将是下列之一:

The type of mouse cursor currently being displayed. 
It will be one of the following words:
    AppStarting, Arrow, Cross, Help, IBeam, Icon, No, Size, SizeAll, SizeNESW, SizeNS, 
    SizeNWSE,     SizeWE, UpArrow, Wait, Unknown.

此代码检查是否有闪烁的光标

if A_Cursor != Ibeam
    msgbox, Not Waiting for input
else
    msgbox, Waiting for input
return

相关内容