Jump to content

Recommended Posts

Posted

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!

Posted (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 by Melba23
Fixed formatting
Posted (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 by Musashi

Musashi-C64.png

"In the beginning the Universe was created. This has made a lot of people very angry and been widely regarded as a bad move."

Posted

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?

Posted
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).

Musashi-C64.png

"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
Posted
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.
  :)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...