robertsantana Posted September 27, 2022 Share Posted September 27, 2022 Quote expandcollapse popup#include<GUIConstants.au3> #include<MsgBoxConstants.au3> #include<File.au3> #include <ScreenCapture.au3> ;RIO CLARO ShellExecute ("https://portal.gissonline.com.br/") WinWaitActive("Gissonline - Google Chrome") ChecarJanela() Func ChecarJanela() $x = 2 $y = 0 $largura = 1053 $altura = 816 Local $pos = WinGetPos("Gissonline - Google Chrome") ;MsgBox($MB_SYSTEMMODAL, "","X:" & $pos[0] & "Y:" & $pos[1] & "Largura:" & $pos[2] & "Altura:" & $pos[3]) if @error =0 Then If $pos [0] == $x And $pos [1] == $y And $pos [2] == $largura And $pos [3] == $altura Then Else Ajustarjanela($x,$y,$largura,$altura) EndIf EndIf EndFunc Func Ajustarjanela ($x,$y,$largura,$altura) WinMove("Gissonline - Google Chrome","",$x,$y,$largura,$altura) ChecarJanela() EndFunc Sleep(1000) MouseWheel ($MOUSE_WHEEL_DOWN,2 ) Sleep(1500) MouseClick("primary",188,652,1,10) Sleep(1500) MouseClick("primary",434,454,2,10) Sleep(500) Send("login") Sleep(500) Send("{TAB}") Sleep(500) Send("password") MouseClick("primary",533,564,1,10) WinWaitActive("https://wwwx.gissonline.com.br/interna/default.cfm - Google Chrome") MouseClick("primary",370,127,1,10) PixeldeErro() Func IniciatBot() while 1 PixeldeErro() WEnd EndFunc Func PixeldeErro() while 1 $pixel = PixelSearch(0,0,297,110,0xECF2EE) If not @error Then ;PAGINA COM ERRO WinWaitActive("Operação Indisponível - Google Chrome") _ScreenCapture_Capture(@MyDocumentsDir & "\Erro_Rio_CLaro.jpg",2,0,1173,816) ShellExecute("C:\Users\robert.santana\OneDrive\Área de Trabalho\Erros do Gissonline.txt") Sleep(500) Send("Erro na aba de tomador, Rio Claro. {F5}" & @CRLF) Sleep(5000) ExitLoop Else ;SEM ERRO Sleep(1000) WinClose("https://wwwx.gissonline.com.br/interna/default.cfm - Google Chrome") MsgBox($MB_ICONINFORMATION, "Pagina sem erro", "Tudo Certo!") ExitLoop EndIf WEnd EndFunc Here is my script, I need it to recognize an error on the page and let me know, otherwise show me a message that everything is ok. however, the error appears on the page, but even so the message appears that everything is ok. sorry for the english, i'm new to this and new to autoit. Link to comment Share on other sites More sharing options...
robertsantana Posted October 3, 2022 Author Share Posted October 3, 2022 Quote expandcollapse popup#include<GUIConstants.au3> #include<MsgBoxConstants.au3> #include<File.au3> #include <ScreenCapture.au3> ;RIO CLARO ShellExecute ("https://portal.gissonline.com.br/") WinWaitActive("Gissonline - Google Chrome") ChecarJanela() Func ChecarJanela() $x = 2 $y = 0 $largura = 1053 $altura = 816 Local $pos = WinGetPos("Gissonline - Google Chrome") ;MsgBox($MB_SYSTEMMODAL, "","X:" & $pos[0] & "Y:" & $pos[1] & "Largura:" & $pos[2] & "Altura:" & $pos[3]) if @error =0 Then If $pos [0] == $x And $pos [1] == $y And $pos [2] == $largura And $pos [3] == $altura Then Else Ajustarjanela($x,$y,$largura,$altura) EndIf EndIf EndFunc Func Ajustarjanela ($x,$y,$largura,$altura) WinMove("Gissonline - Google Chrome","",$x,$y,$largura,$altura) ChecarJanela() EndFunc Sleep(1000) MouseWheel ($MOUSE_WHEEL_DOWN,2 ) Sleep(1500) MouseClick("primary",188,652,1,10) Sleep(1500) MouseClick("primary",434,454,2,10) Sleep(500) Send("login") Sleep(500) Send("{TAB}") Sleep(500) Send("password") MouseClick("primary",533,564,1,10) WinWaitActive("https://wwwx.gissonline.com.br/interna/default.cfm - Google Chrome") MouseClick("primary",370,127,1,10) PixeldeErro() Func IniciatBot() while 1 PixeldeErro() WEnd EndFunc Func PixeldeErro() while 1 $pixel = PixelSearch(0,0,297,110,0xECF2EE) If not @error Then ;PAGINA COM ERRO WinWaitActive("Operação Indisponível - Google Chrome") _ScreenCapture_Capture(@MyDocumentsDir & "\Erro_Rio_CLaro.jpg",2,0,1173,816) ShellExecute("C:\Users\robert.santana\OneDrive\Área de Trabalho\Erros do Gissonline.txt") Sleep(500) Send("Erro na aba de tomador, Rio Claro. {F5}" & @CRLF) Sleep(5000) ExitLoop Else ;SEM ERRO Sleep(1000) WinClose("https://wwwx.gissonline.com.br/interna/default.cfm - Google Chrome") MsgBox($MB_ICONINFORMATION, "Pagina sem erro", "Tudo Certo!") ExitLoop EndIf WEnd EndFunc Here is my script, I need it to recognize an error on the page and let me know, otherwise show me a message that everything is ok. however, the error appears on the page, but even so the message appears that everything is ok. sorry for the english, i'm new to this and new to autoit. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted October 3, 2022 Moderators Share Posted October 3, 2022 robertsantana, Point 1: Why post exactly the same script as last week? I have merged the 2 - please do not do it again. Point 2: When you post scripts, please use code tags - see here how to do it. Thanks in advance for your cooperation. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Dan_555 Posted October 4, 2022 Share Posted October 4, 2022 (edited) As i'm (atm) not interested in browser automation (and my main browser is iron and not chrome), i do not know if there is an udf which can do this automatically ... But here is an idea, something that you may want to try out: Instead of doing pixel search for the error text, you can activate the window, then send "ctrl a" keys to select all text, then send "ctrl c" to copy the text to the clipboard. After that you can read out the clipboard content in a variable and check if it contains the error message. Then you can proceed in your script or stop it. That's how i would approach it. Edited October 4, 2022 by Dan_555 Some of my script sourcecode Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now