Autohotkey - How do I detect if the mouse cursor changed to a text cursor?

时间:2016-10-19 13:39:48

标签: autohotkey

I want to know whether the mouse cursor has changed to a text cursor and to activate new actions for it.

The code below:

#IfWinActive, ahk_exe chrome.exe

/* I want to put the if statement here; if not text cursor then the following would be activated */

Left::
{
  SendInput, ^+{Tab} ; Navigate one tab back in chrome
}
return

Right::
{
  SendInput, ^{Tab} ; Navigate one tab forward in chrome
}
return

/* End of the if statement */

#IfWinActive

Thanks a million!

1 个答案:

答案 0 :(得分:2)

有内置变量。

A_Cursor - https://autohotkey.com/docs/Variables.htm#Cursor

在您的情况下,您很可能有兴趣检查它是否存储IBeam值。

所以,例如:

#If WinActive("ahk_exe chrome.exe") and (A_Cursor != "IBeam")
Left::
    SendInput, ^+{Tab} ; Navigate one tab back in chrome
return
(...)

旁注,如上所示,在定义热键时不需要括号。