If WinTitle = and Focused Control Text = ?

Get help with using AutoHotkey and its commands and hotkeys
chef423
Posts: 213
Joined: 28 Aug 2016, 12:10
Google: Christopher Smith
GitHub: chef23

If WinTitle = and Focused Control Text = ?

03 Aug 2018, 12:34

I have a Dialog box I need to read the text from, if its 'The credit card failed to process.' I need to Sleep, 5000

The WInTitle is 'Payment Processor Error'

If WinTitle, Payment Processor Error
AND
Focused Control (Text), The credit card failed to process.
THEN
Sleep, 5000
Else
Move on with my code.

I see this post: https://autohotkey.com/boards/viewtopic.php?t=23987
AND
This here: https://autohotkey.com/docs/commands/ControlGetText.htm

looking for some syntax assistance and to fully know if reading from the Text in the Focused Control box is actually doable.

Thanks in advance.
Vh_
Posts: 201
Joined: 17 Mar 2017, 22:06

Re: If WinTitle = and Focused Control Text = ?

03 Aug 2018, 23:46

If you are assigning this to a key, you might check out the ControlGetFocus command in conjunction with ControlGetText. If not, you could put in a loop maybe.

Code: Select all

;Untested, theoretical code
Loop
{
WinGetTitle, WinTitleVar, a ; a=active
ControlGetFocus, OutVarControlName...etc
ControlGetText, OutVarText....etc
}
Until (WinTitleVar = "Payment Processing Error" and OutVarText = "Text")
;----------------------------or use If, break then do X
https://autohotkey.com/docs/commands/Co ... tFocus.htm

Hope this points you in the right direction!

Return to “Ask For Help”

Who is online

Users browsing this forum: anhnha, Chunjee, Helgef, RubbeH, sobuj53, TAC109, VibinonAHk and 38 guests