MrWho1990 Posted April 9, 2020 Posted April 9, 2020 Just trying to get a script for work running that automatically refreshes the screen passes on a color appearing, however, the button isn't being pressed. I just want the color to appear, the button to press, then unpress, wait a specified time (I was thinking 30ish second), then check again and refresh. (This color tends to appear after 15 seconds, but I don't want to be constantly refreshing) So far I have this: while 1 $e = PixelSearch( 1500, 1200, 100, 1300, 0x0582FF, 10) if $e = true then send("g") sleep(30000) endif wend Thanks ahead of time!
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 Also, new to autoit, so sorry for the easy question!
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 Actually, apologies! I think this is the wring spot.
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 (edited) Just trying to get a script for work running that automatically refreshes the screen passes on a color appearing, however, the button isn't being pressed. I just want the color to appear, the button to press, then unpress, wait a specified time (I was thinking 30ish second), then check again and refresh. (This color tends to appear after 15 seconds, but I don't want to be constantly refreshing) So far I have this: while 1 $e = PixelSearch( 1500, 1200, 100, 1300, 0x0582FF, 10) if $e = true then send("g") sleep(30000) endif wend Thanks ahead of time! Edited April 9, 2020 by Melba23 Fixed formatting
Musashi Posted April 9, 2020 Posted April 9, 2020 (edited) Check the Help for PixelSearch ! Success : a two-element array of pixel's coordinates. (Array[0] = x, Array[1] = y).Failure : sets the @error flag to 1 if the color is not found. HotKeySet("{ESC}", "Terminate") Local $aCoord While True $aCoord = PixelSearch(1500, 1200, 1600, 1300, 0x0582FF, 10) If Not @error Then ConsoleWrite("+ >> Color found " & @CRLF) Send("g") Sleep(30000) Else ConsoleWrite("+ >> Color not found " & @CRLF) Sleep(1000) EndIf WEnd Func Terminate() Exit EndFunc ;==>Terminate Edit : @MrWho1990 ->BTW : if you have not already done so, please take a look at the forum-rules . Edited April 9, 2020 by Musashi "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 OMG, I'm so silly. Thank you so much. I skipped what it returned. OOF, thanks!
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 Do I need to get a window handle if I'm running this in an application? Because the updates aren't currently working.
MrWho1990 Posted April 9, 2020 Author Posted April 9, 2020 Also, I didn't think I was breaking any rules. Apologies if there's something I missed, but I didn't see anything on the rule list that would fit this situation?
Musashi Posted April 9, 2020 Posted April 9, 2020 1 minute ago, MrWho1990 said: Also, I didn't think I was breaking any rules. ... I'm not saying you're violating the forum rules. But once you work with functions like PixelSearch, it can't hurt to read them (which, of course, you should always do as a new member) . 7 minutes ago, MrWho1990 said: Do I need to get a window handle if I'm running this in an application? Because the updates aren't currently working. Post what you have done so far (please a complete script, not just an excerpt). "In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."
Developers Jos Posted April 9, 2020 Developers Posted April 9, 2020 59 minutes ago, MrWho1990 said: Actually, apologies! I think this is the wring spot. Just ask for getting it moved with the report button, instead of creating a new topic. Merged. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
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