ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

IDEA: Moving Keyboard focus to a control

(1/1)

kiran45:
Hi
I love autohotkey. Thanks for the great program.

Though I use autohotkey scrips regularly, one simple command is driving me crazy. Hope somebody will help.

I have a html page with many controls and one of them is defined like this:

<input type="text" name="textbox1" id="textboxid1" value="">

Now how can I move my keyboard focus to this control irrespective of where the focus is.
I am using this:

--- ---!q:: ;shortcut key
controlfocus, textbox1
I do not want to give window title, as I want to use the current window

Please help
Thanks

jgpaiva:
ControlFocus is used for focusing stactic controls of the current window itself (in this case the browser). Thus, it can't focus parts of webpages.

I'd suggest you do 2 things on the script:
first, lose the focus (send,{esc}) and then, depending on your webbrowser, tab a number of times until you get to where you need the focus (send,{tab}).

Hope that helps!

PS: actually, autohotkey isn't a DonationCoder project, we just use it a lot ;)

kiran45:
Hi
thanks for the alternative

regards
kiran

tinjaw:
I suggest using JavaScript and the DOM to set the focus on the element you want. Don't rely on tabs because there are many things that will cause that to be different under various conditions. If you name the element and use the DOM it won't matter how many tabs you think it might be.

lanux128:
btw, you didn't mention what browser are you using because if you're using Firefox then AHK would not be much of a use..

Navigation

[0] Message Index

Go to full version