Jump to content

Recommended Posts

Posted

Looked through the help file, it just says that the color commands return the RGB value, I'm sure I'm just missing something as to how to implement this to check the pixel color. If the color is right, I would like the script to proceed, but if its wrong I need to have a 1 second delay to allow it to load. Any suggestions?

Posted

I would also like to know if I can run a loop for a set amount of seconds, and then switch to another infinate loop.

PS, here is the code I am using, feel free to do anything with it, its just my newbie attempt at a macro.

sleep (1500)

HotKeySet("{ESC}", "Terminate")

While 1

send ("{F2}")
sleep (1200)
send ("{F5}")
sleep (1700)


mouseClick ("left", 635, 345, 1)
mouseClick ("left", 635, 345, 1)

mouseClick ("left", 665, 345, 1)
mouseClick ("left", 665, 345, 1)

send ("{F1}")

sleep (5000)

send ("{F3}")
sleep (1200)
send ("{F5}")
sleep (1700)

mouseClick ("left", 635, 345, 1)
mouseClick ("left", 635, 345, 1)

mouseClick ("left", 665, 345, 1)
mouseClick ("left", 665, 345, 1)

send ("{F1}")

sleep (5000)

send ("{F4}")
sleep (1200)
send ("{F5}")
sleep (1700)

mouseClick ("left", 635, 345, 1)
mouseClick ("left", 635, 345, 1)

mouseClick ("left", 665, 345, 1)
mouseClick ("left", 665, 345, 1)

send ("{F1}")

sleep (5000)
WEnd

Func Terminate()
   Exit
EndFunc

The two coordinates in there are the ones I would like to check, the color for the first is 495D4B and the second is 000000.

Thanks again

  • Developers
Posted

I would also like to know if I can run a loop for a set amount of seconds, and then switch to another infinate loop.

$begin = TimerStart()
; first loop will loop for 5 seconds
Do
  ; First loop code 
    ...
Until TimerStop($begin) > 5000
;
While 1
  ;  Endless loop code
   ........
Wend

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

  • Developers
Posted (edited)

Ok, if it doesnt find the pixel, I want it to pause for a second, where should I put that?

If "495D4B" = Hex(PixelGetColor(635, 345),6) Then
; do stuff
Else
   sleep(1000)
EndIf
Edited by JdeB

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

Posted

THe following code sleeps for a second at a time until the pixel contains the desired colour.

While "495D4B" <> Hex(PixelGetColor(635, 345),6)
  Sleep(1000)
EndIf

GrahamS

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