AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How to detect if cursor is in a browser form input field?

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
keyboardfreak



Joined: 09 Oct 2004
Posts: 143
Location: Budapest, Hungary

PostPosted: Mon Jun 30, 2008 4:13 pm    Post subject: How to detect if cursor is in a browser form input field? Reply with quote

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
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 1033

PostPosted: Mon Jun 30, 2008 5:10 pm    Post subject: Reply with quote

no clever ideas about ff
about ie now thats another story
_________________
Read this
Com
Automate IE7 with Tabs
Back to top
View user's profile Send private message
Visioneer



Joined: 19 Nov 2007
Posts: 42

PostPosted: Mon Jul 21, 2008 5:27 pm    Post subject: Reply with quote

So what's the story for IE please.
Back to top
View user's profile Send private message
HugoV



Joined: 27 May 2007
Posts: 650

PostPosted: Mon Jul 21, 2008 7:32 pm    Post subject: Reply with quote

Click the links in tanks signature
Back to top
View user's profile Send private message
tank



Joined: 21 Dec 2007
Posts: 1033

PostPosted: Mon Jul 21, 2008 7:46 pm    Post subject: Reply with quote

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
View user's profile Send private message
keyboardfreak



Joined: 09 Oct 2004
Posts: 143
Location: Budapest, Hungary

PostPosted: Sun Aug 24, 2008 8:21 pm    Post subject: Re: How to detect if cursor is in a browser form input field Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group