I already had it on the run but I also wanted automating clicking the test button and read the success message.
here it hangs.
It generates Source code and then sends it to AHKStudio
Code: Select all
;/¯¯¯¯ FindText_GUI_CatchImage ¯¯ 190414180348 ¯¯ 14.04.2019 18:03:48 ¯¯\
WINf:
SetTitleMatchMode,2
#IfWinActive,
#f::
Last_A_This:=A_ThisFunc . A_ThisLabel
; ToolTip1sec(A_LineNumber . " " . A_ScriptName . " " . Last_A_This )
WinGetActiveTitle,at
WinGetClass,ac, A
WinGet, active_id, ID, A
wTit := "Capture Image To Text And Find Text Tool ahk_class AutoHotkeyGUI"
wTit2 := "FindText_GUI_CatchImage.ahk"
wCapture=Capture Image To Text ahk_class AutoHotkeyGUI ; mouseWindowTitle=0x261cfc ;
DetectHiddenWindows,On
WinClose,% wCapture ,,,19
tooltip, WinWaitClose wCapture 19-04-14_17-11
WinWaitClose,% wCapture,,4
IfWinExist,
MsgBox,"error " A_LineNumber
Sleep,100
WinClose,% wTit
tooltip, WinWaitClose 19-04-14_16-54,,,19
WinWaitClose,% wTit,,4
IfWinExist,
MsgBox,"error " A_LineNumber
Sleep,100
WinClose,% wTit2 ,,,19
; tooltip, WinWaitClose wTit2 19-04-14_16-56
tooltip,% A_LineNumber ,,,19
WinWaitClose,% wTit2,,4
IfWinExist,
MsgBox,"error " A_LineNumber
tooltip,,,,19
run,FindText\FindText_GUI_CatchImage.ahk
SetTitleMatchMode,1
DetectHiddenWindows,Off
tooltip,winwait,,,19
winwait,% wTit
tooltip, ,,,19
ControlClick,Button1,% wTit
WinWaitClose,% wTit
winwait,% wTit2,,,19
WinWait,% wCapture
WinGetPos,wX,wY
MouseClick,left,% wX + 30,% wY + 70
Sleep,2500
;ControlClick,Button10,% wTit ;Gray2Two
Send,{tab}{space}
Send,{tab 7}
;MsgBox, 19-04-14_17-07
tooltip,% A_LineNumber ,,,19
WinWaitClose,% wCapture
Sleep,100
tooltip,% A_LineNumber ,,,19
WinWaitClose,% wTit2
ControlGetText,text,Edit2,% wTit
text := RegExMatch(text,"(Text\:\=""[^""]+"").*",match)
text := RegExReplace(text,"m).*\b(Text\:\=""[^""]+"").*","$1")
if(strlen(match1)>500)
{
MsgBox, prob to long 19-04-14_17-44
return
}
Sleep,100
tooltip,% A_LineNumber "`n" match1,,,19
ControlClick,Button2,% wTit ; Test
tooltip, ,,,19
SuccessProcent := 0
SetTitleMatchMode,3
needle=1 ahk_class #32770 ; mouseWindowTitle=0x312060 ;
while(1){
IfExist,% needle
{
SuccessProcent := 100
WinClose,% needle
tooltip,% A_LineNumber ,,,19
WinWaitClose,% needle
}
IfWinNotExist,% wCapture
SuccessProcent := 100
if(SuccessProcent)
Break
WinGetActiveTitle,atTemp
tooltip,% A_LineNumber ,,,19
WinWaitNotActive,% atTemp,,20
}
if(SuccessProcent)
WinClose, % wCapture0
tooltip,% A_LineNumber ,,,19
WinWaitClose, % wCapture
tooltip,,,,19
WinActivate,ahk_id %active_id%
c0=needle=%at% ahk_class %ac%
t =
(
/*
%match1%
WinGetPos, wX, wY, wW, wH, `% needle ; https://www.autohotkey.com/boards/viewtopic.php?f=6&t=17834&p=271791#p271791
if(wX && ok:=FindText(wX, wY,wX+wW,wY+wH, 0.3, 0.1, Text)) ; findTextTool_demo_backwardsLoop_bottomTooTop(ok)
for i,v in ok
MouseMove, X:=v.1+v.3//2, Y:=v.2+v.4//2
#Include *i `%A_ScriptDir`%\inc_ahk\findTextTool.inc.ahk
#Include *i `%A_ScriptDir`%\inc_ahk\..\findTextTool.inc.ahk
/*
)
c0 .= "`n" t "`n`n`n"
; MsgBox,% c0
sendClipboard(c0) ; or use something like Send,^v
Return
;\____ FindText_GUI_CatchImage __ 190414180357 __ 14.04.2019 18:03:57 __/