Needs script for searching for a color

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
Zeismic
Newbie
Posts: 3
Joined: Wed Oct 02, 2002 2:33 pm

Needs script for searching for a color

Post by Zeismic » Wed Oct 02, 2002 2:46 pm

Problem solved. Thanx alot for the help!
Last edited by Zeismic on Mon Oct 14, 2002 9:46 pm, edited 1 time in total.

Ernest

Where's the colour ...

Post by Ernest » Mon Oct 14, 2002 12:50 pm

Hi, I've got it.
This script creates a result file (C:\MSched_WheresTheColour.txt) as well. That will give you the information if there's a "pattern" regarding the pixel position after a few runs. Feel free to shrink the script to "single liner" :-) Have fun.

BTW: I'm a German, so you've to excuse if anything is wrong with my writing ...

Ernest

Code: Select all

//ScriptStart----------------------------------------------

CapsOff
Label>Setting
Let>XPos=48
Let>YPos=146
Let>FinalXPos=393
Let>FinalYPos=446
Let>MinToWait=55
Let>RightColour=6541311
Let>Result=No Colour

Label>GetPixelColour
If>XPos=%FinalXPos%,NextLine
If>YPos=FinalYPos,WaitALittle
GetPixelColor>%XPos%,%YPos%,Result
If>Result=%RightColour%,Success
Add>XPos,1
Goto>GetPixelColour

Label>NextLine
Let>XPos=48
Add>YPos,1
Goto>GetPixelColour

Label>WaitALittle
Let>SecToWait=%MinToWait%*60
Message>Waiting for %MinToWait% min. till next check will be started.%CRLF%Stay tuned ...
Wait>SecToWait
CloseWindow>Macro Scheduler Message*
Goto>Setting

Label>Success
TimeStamp>c:\MSched_WheresTheColour.txt, Pixelcolour: %RightColour% - found at screenposition: %XPos%:%YPos%
Wait>SecToWait
Message>%CRLF%Please keep your hands away from the mouse now!%CRLF%Will move to mouse position %XPos%:%YPos%%CRLF%in 3. seconds to Click !
Wait>3
CloseWindow>Macro Scheduler Message*
MouseMove>%XPos%,%YPos%
LClick
Goto>WaitALittle

//ScriptEnd-----------------------------------------------

Zeismic
Newbie
Posts: 3
Joined: Wed Oct 02, 2002 2:33 pm

Great Script, but...

Post by Zeismic » Mon Oct 14, 2002 8:48 pm

Thanx alot! Great work you have done here, but I got a small problem with the script though...

When I try to run it I get this error:
Invalid Numeric or Date Format In "Add>XPos,1"
I tryed to figure out what could be wrong, but it all seems OK.
Do you know what could be wrong?

Zeismic
Newbie
Posts: 3
Joined: Wed Oct 02, 2002 2:33 pm

Post by Zeismic » Mon Oct 14, 2002 9:45 pm

Sorry, my mistake! Found the course.
Works like a charm now. Thanx alot!

DarkPinK
Newbie
Posts: 4
Joined: Tue Dec 10, 2002 1:41 am

Re: Great Script, but...

Post by DarkPinK » Fri Dec 13, 2002 3:10 am

Zeismic wrote:Thanx alot! Great work you have done here, but I got a small problem with the script though...

When I try to run it I get this error:
Invalid Numeric or Date Format In "Add>XPos,1"
I tryed to figure out what could be wrong, but it all seems OK.
Do you know what could be wrong?

Code: Select all

test

DarkPinK
Newbie
Posts: 4
Joined: Tue Dec 10, 2002 1:41 am

Post by DarkPinK » Fri Dec 13, 2002 3:14 am

Zeismic wrote:Sorry, my mistake! Found the course.
Works like a charm now. Thanx alot!
I am getting the same error message. How did you get it to work

Ernest

Post by Ernest » Fri Dec 13, 2002 7:38 pm

Hi,
got the same, but only if I've started the script from within the MSched Editor (not from the tray). :?

MSched. 6.0

E.

dimmo

Post by dimmo » Fri Jan 02, 2004 7:00 am

hey every1, how can i set a click location to the 1 where color was identified ??

EX: Color was identified at 744,392 position...
And I wanna make mouse click there and reset after !!!

thnx

dimmo

Post by dimmo » Fri Jan 02, 2004 9:42 am

blah blah blah.. whatever :)))

U made an erro man !!


//ScriptStart----------------------------------------------

CapsOff
Label>Setting
Let>XPos=48
Let>YPos=146
Let>FinalXPos=393
Let>FinalYPos=446
Let>MinToWait=55
Let>RightColour=6541311
Let>Result=No Colour

Label>GetPixelColour
If>XPos=%FinalXPos%,NextLine
If>YPos=%FinalYPos%,WaitALittle
GetPixelColor>%XPos%,%YPos%,Result
If>Result=%RightColour%,Success
Add>XPos,1
Goto>GetPixelColour

Label>NextLine
Let>XPos=48
Add>YPos,1
Goto>GetPixelColour

Label>WaitALittle
Let>SecToWait=%MinToWait%*60
Message>Waiting for %MinToWait% min. till next check will be started.%CRLF%Stay tuned ...
Wait>SecToWait
CloseWindow>Macro Scheduler Message*
Goto>Setting

Label>Success
TimeStamp>c:\MSched_WheresTheColour.txt, Pixelcolour: %RightColour% - found at screenposition: %XPos%:%YPos%
Wait>SecToWait
Message>%CRLF%Please keep your hands away from the mouse now!%CRLF%Will move to mouse position %XPos%:%YPos%%CRLF%in 3. seconds to Click !
Wait>3
CloseWindow>Macro Scheduler Message*
MouseMove>%XPos%,%YPos%
LClick
Goto>WaitALittle

//ScriptEnd-----------------------------------------------

dimmo

Post by dimmo » Fri Jan 02, 2004 9:49 am

but great script, thnx alot for ur help !!!

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts