Sign in to follow this  
Followers 0
xCausxn

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

9 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Ok thanks so if i changed coord to Array[0] would that work.

I am a real newbie thanks for the quick response

Share this post


Link to post
Share on other sites

Have a look again, and see the working example code at the bottom. Just about every function in the Help file has working example code. That should help you understand how it works.


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Ok i think im interpreting the help file wrong,

If i set "If Not @error Then" it will run the mouseclick

whereas if it set doesnt match it will not run

Share this post


Link to post
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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0