3

I have many hotkeys to navigate chrome very efficiently but they get in the way when I try to type anything anywhere.

Can't figure out how to have autohotkey respond to a textfield being active or to the cursor caret being in effect

I've tried using (!A_CaretX) but I'm not really sure how to.

For example, I want it so when I press "d", it opens a new tab, however when in a text field, I'll probably want key press "d" to output character "d" instead of opening a new tab. Toggleing "suspend mode" through other hotkeys is out of the question.

I also need the hotkeys to go back to working as soon as I'm outside a text field

David Chavez
  • 138
  • 1
  • 8

1 Answers1

4

Before the hotkeys you want to suspend, put #If ( A_Cursor != "IBeam" ). Everything between this line and the next #If will be context-sensitive to whether your mouse cursor state is an IBeam or not.

#If ( A_Cursor != "IBeam" )

[hotkeys you want to be context-sensitive]

#If

[hotkeys you DON'T want to be context-sensitive]

Here are the related items from the help documentation:
A_Cursor (built-in variable containing the type of cursor being displayed)
#If (context-sensitive if)

Note that since this is capturing the mouse's cursor type, you'll need to ensure that the mouse is constantly within the text field when you expect the hotkeys to be suspended. For instance, if you click in a text field but move your mouse off the text area (such that it looks like a regular arrow again) the hotkeys won't be suspended, even though you can type.

EJE
  • 1,868
  • 2
  • 8
  • 18
  • Right! I thought of that and thought that might occur but kind of beats the whole purpose because I want to control the computer with as little mouse interaction as possible to improve my efficiency while working on the computer. Is there anything else you can think of? Have you tried A_CaretX? – David Chavez Jul 29 '19 at 04:00
  • I've noticed that A_Caret only works on note editors but not on chrome. If I could get it to work on chrome, it would solve this whole thing. – David Chavez Jul 29 '19 at 04:04
  • Unfortunately, browsers with custom controls (like Chrome and Firefox) don't expose the caret globally. You may need to use something like Selenium to get what you want, however, this isn't something I'm know much about. – EJE Jul 29 '19 at 12:10