DragonFroot Posted December 23, 2018 Posted December 23, 2018 While(1) buybutton (864, 622) WEnd Func buybutton ($x, $y) $target = PixelSearch($x -5, $y -300, $x +5, $y +300, 0xFFEE8C,5) If not (@error) Then sleep (100) Mouseclick("left",$target[0], $target[1], 1, 1) $purple = PixelSearch(894, 589, 895, 590, 0xFFC8C8,5) If $purple=not @error Then Mouseclick("left",894, 589, 1, 1) sleep (5000) EndIf EndIf EndFunc I'm trying to make a program where it commences a pixelsearch, and after it clicks the button, it pixelsearches again for another button that will appear. However my program is ignoring the pixelsearch - it's executing the second mouseclick before the second button even shows. What am I doing wrong?
DragonFroot Posted December 23, 2018 Author Posted December 23, 2018 I've found the problem sort of... It's that the second button took a while to load, and so the program couldnt find it and just ended the script. How do I make the program wait until the button appears
AutoBert Posted December 23, 2018 Posted December 23, 2018 It's no good idea to automate a online-shop ( buybutton) with pixelsearch use the webdriver-udf. And to do this in a loop is also no good idea!
Nine Posted December 23, 2018 Posted December 23, 2018 10 hours ago, DragonFroot said: How do I make the program wait until the button appears $Count = 0 While True $ret = pixelsearch (....) if not @error then exitloop ; found so leave the loop $Count += 1 if $Count > 100 then return ; if not found after 10 secs leave the function sleep (100) Wend ; $ret contains the x,y position “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) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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