How to detect input field in every application?

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
tatagi
Posts: 181
Joined: 23 Aug 2018, 11:17

How to detect input field in every application?

07 Aug 2020, 21:23

I'd like to use hotkey that is only activated when input field is focused by mouse cursor. (ex: chrome search box, notepad text field, find text box etc)

for instance like this:

Code: Select all

^lbutton::
send, {click}^ac
return

so this is when I press ctrl + click left mouse button on form field, it sends the mouse click once in the form field, and select all and copy it so I can do whatever I want after that.


any tips?
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: How to detect input field in every application?

07 Aug 2020, 21:35

That’s sending ^a but not ^c. It sends ^a and c. You can do this:

Code: Select all

^lbutton::send, {click}^a^c
or this:

Code: Select all

^lbutton::send, {click}{ctrl down}ac{ctrl up}

Note that you can do single-command hotkeys on the same line without a return.
tatagi
Posts: 181
Joined: 23 Aug 2018, 11:17

Re: How to detect input field in every application?

07 Aug 2020, 21:49

boiler wrote:
07 Aug 2020, 21:35
That’s sending ^a but not ^c. It sends ^a and c. You can do this:

Code: Select all

^lbutton::send, {click}^a^c
or this:

Code: Select all

^lbutton::send, {click}{ctrl down}ac{ctrl up}

Note that you can do single-command hotkeys on the same line without a return.

oh thanks I wasn't aware of that :crazy: , and do you have a clever idea how to detect input field? I squeeze my head to figure that out but failed.
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: How to detect input field in every application?

07 Aug 2020, 22:02

It is very different depending on the application, especially when the input field doesn’t have a specific control (in a Windows control sense) associated with it, as is the case with most or all browsers. I doubt there is a great way of knowing you’re in an input field consistently except to rely on you not pressing ^LButton if you weren’t.
tatagi
Posts: 181
Joined: 23 Aug 2018, 11:17

Re: How to detect input field in every application?

07 Aug 2020, 22:13

boiler wrote:
07 Aug 2020, 22:02
It is very different depending on the application, especially when the input field doesn’t have a specific control (in a Windows control sense) associated with it, as is the case with most or all browsers. I doubt there is a great way of knowing you’re in an input field consistently except to rely on you not pressing ^LButton if you weren’t.

I c.. then is it easier to detect every input field in single application, specifically chrome browser? most of my use of computer is on browsing internet.
User avatar
boiler
Posts: 16926
Joined: 21 Dec 2014, 02:44

Re: How to detect input field in every application?

07 Aug 2020, 22:27

In other specific applications, it would be easier because you could find out what the focused control is and see if it’s an edit box or similar, but as I mentioned, browsers don’t use Windows controls.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: ConnorMcLoud and 183 guests