Why does the following return the same value, Internet Explorer_Server1, no matter what text box the focus is on?
I'm a day old newbie so perhaps I missed something. I'm trying make sure a Hot key script only executes in specific text box and the I attempted to use the code below to determine what the control "name" is. Id then use ControlGetfocus and check it's return against the desired value in if block
f1::
ControlGetfocus, OutputVar , APvX Accessioning - Internet Explorer
if ErrorLevel
MsgBox, The target window doesn't exist or none of its controls has input focus.
else
MsgBox, Control with focus = %OutputVar%
return
ControlGetfocus retuns same value for all text boxes!?
Re: ControlGetfocus retuns same value for all text boxes!?
It doesn't look like Internet Explorer works with ControlGetFocus:
http://www.autohotkey.com/board/topic/6 ... -webpages/
http://www.autohotkey.com/board/topic/6 ... -webpages/
Re: ControlGetfocus retuns same value for all text boxes!?
GRRRRRRRRR !
New question/comment ... Is AHK one of those quirky inconsistent systems rife with exceptions and funkiness [all undocumented of course] that can only be used after you know the secret handshake and go through a long and painful apprenticeship?
Thank you Master.
I hope someday to be worthy for AHK looks like valuable tool ... but it's obvious it isn't free
New question/comment ... Is AHK one of those quirky inconsistent systems rife with exceptions and funkiness [all undocumented of course] that can only be used after you know the secret handshake and go through a long and painful apprenticeship?
Thank you Master.
I hope someday to be worthy for AHK looks like valuable tool ... but it's obvious it isn't free
Re: ControlGetfocus retuns same value for all text boxes!?
I don't know what you're trying to do, but you could just make macros for your keyboard perhaps. That's very simple.
+Space::
Msgbox, you now pressed shift + space
Return
^Space::
Msgbox, you now pressed ctrl + space, I'm gonna open notepad and paste the word hey
Run, notepad
WinWait, ahk_exe notepad.exe,, 5
Sendraw, hey
Return
+Space::
Msgbox, you now pressed shift + space
Return
^Space::
Msgbox, you now pressed ctrl + space, I'm gonna open notepad and paste the word hey
Run, notepad
WinWait, ahk_exe notepad.exe,, 5
Sendraw, hey
Return
Re: ControlGetfocus retuns same value for all text boxes!?
Code: Select all
SetTitleMatchMode, 2
Loop,
{
Sleep, 200
ifWinActive, SoundCloud
msgbox, a window with the word SoundCloud in its title appears to be open, you can write hotkey commands here to perform macros
}
Re: ControlGetfocus retuns same value for all text boxes!?
There are many different frameworks that could be used to implement a program's user interface. Each framework works differently, so it is inevitable that a program like AutoHotkey can't use exactly the same methods for every program. Web browsers have a standards-based document object model that they have to use, so generally they don't use standard Windows controls of the kind ControlGet works with.occam49 wrote:Is AHK one of those quirky inconsistent systems rife with exceptions and funkiness [all undocumented of course] that can only be used after you know the secret handshake and go through a long and painful apprenticeship?
While it's true that AutoHotkey has quite a few quirks and inconsistencies, some of those (such as the one you've encountered) are due to the variety of programs and systems that it must work with. Most of the exceptions and funkiness that AutoHotkey itself is responsible for (and some that it isn't responsible for) are documented in the help file. An understanding of the program you're trying to automate can be as (or more) important than understanding AutoHotkey's full capabilties.
Who is online
Users browsing this forum: Mannaia666, skeerrt and 153 guests