| View previous topic :: View next topic |
| Author |
Message |
keyboardfreak
Joined: 09 Oct 2004 Posts: 143 Location: Budapest, Hungary
|
Posted: Mon Jun 30, 2008 4:13 pm Post subject: How to detect if cursor is in a browser form input field? |
|
|
I'd like to add hotkeys to certain webpages, like remapping some keyboard shortcuts in GMail and RTM.
I'd like to do it in AutoHotkey rather than hacking the page source with javascript.
The problem is the shortcuts are single-key letter shortcuts, so when I remap them the remapping interferes with typing into input fields. Consequently, they should be remapped only if the user isn't currently typing into an input field.
Is it possible to determine if the cursor is currently in a form input field or not? It's firefox and as Window Spy shows the whole page is a single entity, so there are no individual widgets for the input fields.
Anyone has a clever idea how to detect it anyway? |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
Posted: Mon Jun 30, 2008 5:10 pm Post subject: |
|
|
no clever ideas about ff
about ie now thats another story _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
Visioneer
Joined: 19 Nov 2007 Posts: 42
|
Posted: Mon Jul 21, 2008 5:27 pm Post subject: |
|
|
| So what's the story for IE please. |
|
| Back to top |
|
 |
HugoV
Joined: 27 May 2007 Posts: 650
|
Posted: Mon Jul 21, 2008 7:32 pm Post subject: |
|
|
| Click the links in tanks signature |
|
| Back to top |
|
 |
tank
Joined: 21 Dec 2007 Posts: 1033
|
Posted: Mon Jul 21, 2008 7:46 pm Post subject: |
|
|
try to look at my scripts and see if you can figure soemthng out
post what you tried and ill fix it for ya
hint would be in lookin at how i use javascript and the dom extractor tool where i look at events _________________ Read this
Com
Automate IE7 with Tabs |
|
| Back to top |
|
 |
keyboardfreak
Joined: 09 Oct 2004 Posts: 143 Location: Budapest, Hungary
|
Posted: Sun Aug 24, 2008 8:21 pm Post subject: Re: How to detect if cursor is in a browser form input field |
|
|
| keyboardfreak wrote: | Is it possible to determine if the cursor is currently in a form input field or not? It's firefox and as Window Spy shows the whole page is a single entity, so there are no individual widgets for the input fields.
Anyone has a clever idea how to detect it anyway? |
I have an idea. I put it here if anyone feels like implementing it. IE is no problem I think, so Firefox and other browsers need some solution.
Both Firefox and Opera has GeaseMonkey (FF plugin, Opera built-in). There should be a GreaseMonkey script which monitors focus events in Javascript. If a form field gets the focus then it puts a tiny, say, red rectangle in the lower left corner of ther browser window. If no field has the focus then the rectangle is green.
Knowing the position of the rectangle the Autohotkey script could detect with get pixel whether a form field is currently focused or not.
The tiny rectangle can be displayed above current page content using the DOM and styles. Being tiny it wouldn't be annoying and it could provide the necessary information for the AHK script. |
|
| Back to top |
|
 |
|