Page 1 of 1

Monitor for colors appearing and use If/then

Posted: Mon Dec 08, 2014 10:18 pm
by Steve8G
How can I make it click on a specific area depending if the color red appear on a specific pixel on the window

Re: Monitor for colors appearing and use If/then

Posted: Wed Dec 10, 2014 7:47 am
by Oleg
I think yes.
You can check the color pixel periodically and make necessary actions if color corresponds your etalon.

algorithm will be like this

Code: Select all

Window pixel
Color Compliance
if result = true then
   .....
   do something
   .....
end if
See actions:

Re: Monitor for colors appearing and use If/then

Posted: Thu Dec 11, 2014 6:44 pm
by Steve8G
Thanks but the complicated part is that it will have to wait for the pixel on the screen to change for the desired color, so it will have to be monitoring the screen all the time to see if the color change, then when it will change for the desired color, it will do the appropriate action

is it possible?

Re: Monitor for colors appearing and use If/then

Posted: Fri Dec 12, 2014 1:25 pm
by Oleg
See my example.
This task waits when the color on specified screen pixel will be Blue ($00800000)

Save the text of the task into a file and use menu Task->Import

Code: Select all

 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1111"
Hide=INTEGER|0
ID=INTEGER|1830696294
LogOnAsUser=INTEGER|1
Name=STRING|"Wait for color"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
Action5=FOLDER
Action6=FOLDER
Action7=FOLDER
Action8=FOLDER
Action9=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create local variable ""COLORMATCHED"" with value ""false"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varkind=STRING|"1"
varname=STRING|"COLORMATCHED"
varvalue=STRING|"false"

[Actions\Action2]
ActionID=STRING|"A_LOOP_WHILE"
Enabled=INTEGER|-1
Name=STRING|"While loop"
Params=FOLDER

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{ColorMatched}"

[Actions\Action3]
ActionID=STRING|"A_SCR_SCRPIXEL"
Enabled=INTEGER|-1
Name=STRING|"Screen Pixel"
Params=FOLDER

[Actions\Action3\Params]
variable=STRING|"color"
x=STRING|"111"
y=STRING|"171"

[Actions\Action4]
ActionID=STRING|"A_SCR_COLORCOMPLIANCE"
Enabled=INTEGER|-1
Name=STRING|"Color Compliance"
Params=FOLDER

[Actions\Action4\Params]
color1=STRING|"{color}"
color2=STRING|"$00800000"
tolerance=STRING|"16"
variable=STRING|"ColorMatched"

[Actions\Action5]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|-1
Name=STRING|"If Then"
Params=FOLDER

[Actions\Action5\Params]
case=STRING|"0"
operator=STRING|"1"
type=STRING|"3"
value1=STRING|"{ColorMatched}"

[Actions\Action6]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 500 ms"
Params=FOLDER

[Actions\Action6\Params]
delay=STRING|"500"
dimension=STRING|"0"

[Actions\Action7]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|-1
Name=STRING|"End If"

[Actions\Action8]
ActionID=STRING|"A_LOOP_END"
Enabled=INTEGER|-1
Name=STRING|"End Loop"

[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Point color is Blue!!!!"""
Params=FOLDER

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"Point color is Blue!!!!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"