Jump to content

How to start a section of the script when Colour is detected?


xCausxn
 Share

Recommended Posts

Description says it all.

$coord = PixelSearch(744, 157, 758, 225, 0x181919, 10)
If $coord Then
   MouseClick("left", 894, 169, 1, 20)
   sleep(526)
   MouseClick("left", 803, 79, 1, 20)
   sleep(200)
   MouseClick("left", 70, 545, 1, 20)
EndIf

This is what i attempted but didnt seem to work

i am a noob so please help:)

Link to comment
Share on other sites

Have a look in the help file and check what the return value of PixelSearch() is you will then realize why If $coord Then is not working as you expect it to.

"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning."- Rick Cook

Link to comment
Share on other sites

Another question: Which program to you try to automate? Pixelsearch is very, very slow. So there might be a better solution.

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

Ok so if i change

$coord = PixelSearch(744, 157, 758, 225, 0x181919, 10)
If $coord Then
   MouseClick("left", 894, 169, 1, 20)
   sleep(526)
   MouseClick("left", 803, 79, 1, 20)
   sleep(200)
   MouseClick("left", 70, 545, 1, 20)
EndIf
$coord = PixelSearch(744, 157, 758, 225, 0x181919, 10)
If $coord[0] Then
   MouseClick("left", 894, 169, 1, 20)
   sleep(526)
   MouseClick("left", 803, 79, 1, 20)
   sleep(200)
   MouseClick("left", 70, 545, 1, 20)
EndIf

TO

Would it work

Link to comment
Share on other sites

Please check the help file again (and the examples at the end of the help file).

Not the coordinates are checked but macro @error to see if the specified color was found.

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

Correct, that's how the script is supposed to work.

But my question is still unanswered: Which application do 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

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