Jump to content

Pause a script if pixel becomes of a specific color


Recommended Posts

Hi, I have a simple script that works perfectly, but I would like to put another piece of script that, if a specific point becomes orange (let's say) , the script that I have now pauses and in the meantime autoit should:

1) Click in the coords I give him

2) Waits until a specific pixel becomes white

3) Presses "J"

4) Presses "J" again (after 10 seconds)

The script that I have now should remain paused until the pixel is NOT orange

Until now I have made something, but then I erased it because it did not work

I've thought something like:

If ;don't know how to tell him "If coord is orange"

mousemove (x, y, 1)

mouseclick (x, y, 1)

sleep Until ; don't know how to tell him "Until Pixel at coords X1, Y1 becomes white"

""press J""

sleep (10000)

""press J""

sleep (10000)

;and from now on I don't have idea how to proceed...

Link to comment
Share on other sites

Can you please tell us what kind of application you try to automate?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Something along the lines of this might help you, if you receive errors let me know.

In the PixelGetColor statements you will need to change the number values to the hexadecimal colour value that you want to use to get this value you can use something like this.

$Colour = PixelGetColor(0, 0)
MsgBox(64, "Colour", $Colour)
ClipPut($Colour)

If PixelGetColor(0, 0) = "0000000" Then
MouseMove(100, 100, 1) ; This line is actually pointless because mouseclick deals with this but you asked for it.
MouseClick("Left", 100, 100, 1, 1)
Do
Until PixelGetColor(100, 100) = "FFFFFFF" ; I am using a do until statement to pause the script however im sure there are better ways to do this.
Send("J")
Sleep(10000)
Send("J")
EndIf
Edited by Venix
Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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