DeadAdm1n Posted June 8, 2022 Share Posted June 8, 2022 hello all, my overall goal is to be able to be able to run a script, then it go threw all the panes that it needs to then take screenshots of the pages, that are of value my targeted program is towards vnc viewer, (this is work related, i work flowback in the oil industry) my issue is when im 2-3 pages deep into the vnc i want it to back out to the main screen then go into the next category but my code will keep clicking, causing it to go past the main screen and open up another options pane that will throw the rest of the code off. my code: expandcollapse popup#include <MsgBoxConstants.au3> HotKeySet("e", "EndProgram") func EndProgram() Exit EndFunc WinWait ( '192.168.1.2 (PanelView VNC Server) - VNC Viewer', '' ) WinActivate ( '192.168.1.2 (PanelView VNC Server) - VNC Viewer', '' ) Sleep(1000) WinMove ( '192.168.1.2 (PanelView VNC Server) - VNC Viewer', '', '', '', 710, 710 ) $_WinPos = WinGetPos ( '192.168.1.2 (PanelView VNC Server) - VNC Viewer', '' ) $gold = PixelGetColor($_WinPos[0]+$_WinPos[2]/2.13, $_WinPos[1]+$_WinPos[3]/5.30) ;returns 15446573 ;MsgBox("","gold",$gold) $gold2 = 15446573 ;button locations ;middle- MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/2, $_WinPos[1]+$_WinPos[3]/2, 1 ) ;goldpixel- MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/2.13, $_WinPos[1]+$_WinPos[3]/5.30, 1 ) ;saltwater button- MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/2.5, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) ;main button- MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/1.1, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) ;rolf7 button- ;MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/4, $_WinPos[1]+$_WinPos[3]/2, 1 ) ;rolf 7 backout() ;;Sleep(1000) ;MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/4, $_WinPos[1]+$_WinPos[3]/2, 1 ) ;print() ;MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/6.8, $_WinPos[1]+$_WinPos[3]/5, 1 ) ;sleep(1000) ;send("{PRINTSCREEN}") ;sleep(1000) ;Backout() ;Sleep(1000) ;--------------------------------------------------------functions--------------------------------------------------------- Func print() Sleep(1000) send("{PRINTSCREEN}") sleep(1000) MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/2.5, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) sleep(1000) EndFunc ;back out to main screen Func Backout() IF $gold <> $gold2 then MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/1.1, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) sleep(1000) IF $gold <> $gold2 then MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/1.1, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) ;sleep(1000) ;IF $gold <> $gold2 then MouseClick ( 'Left', $_WinPos[0]+$_WinPos[2]/1.1, $_WinPos[1]+$_WinPos[3]/1.07, 1 ) EndFunc This line of code, that pulls a pixel is a static pixel, no where else in the vnc, that pixel is static and never changes. all ways returns the same variable. $gold = PixelGetColor($_WinPos[0]+$_WinPos[2]/2.13, $_WinPos[1]+$_WinPos[3]/5.30) ;returns 15446573 thank you for your time, if you decided to help, if you cant, thanks for reading. I hope i gave you all enough info and dont confuse anyone. Link to comment Share on other sites More sharing options...
Nine Posted June 8, 2022 Share Posted June 8, 2022 MouseClick and PixelGetColor are the worst way to automate an application. You should truly consider using a control-based approach. Since we do not have your specific application, it is hard for us to help you efficiently. But at first glance, the issue could be that you do not update the $gold variable after each click. If you are interested to use a better approach, you should try using au3info.exe tool to see if controls are readable this way. Also post a printscreen of the application so we can see what it looks like. “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
DeadAdm1n Posted June 8, 2022 Author Share Posted June 8, 2022 i do not have a main screen picture, as i said, i am accessing this program threw a vnc viewer, i will check when i get back to work if there is any info in the au3info has anything in it. 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