Wait for Pixel and like actions confuse me on variable changes

Discuss RoboTask here
Post Reply
Zac
Posts: 18
Joined: Wed Feb 22, 2023 5:14 pm

Wait for Pixel and like actions confuse me on variable changes

Post by Zac »

Hello,

I've been having trouble testing and researching this issue where for example let's say I do the action "Wait for Pixel" it has a thing at the bottom that lets you have a timeout timer for how long you the program can stay on hold if the thing it's looking for takes time such as it loading the page and certain elements where the pixels are looking would otherwise not cause the error message to appear and nothing does appear for the pixels to give the error message. Now this all work here, but the thing that confuses me is when I change the option for Timeout from "Raise TIMEOUT error (default option)" to "Set True of False to variable" I don't think I'm utilizing it properly because all of my testing keeps coming back differently. When I set it as the "Set True of False to variable" I obviously add a variable to it and the tests I've done include leaving the variable blank, putting the text True and False, adding numbers, etc. but I can't seem to get the variable to change when then timeout should occur since it wasn't able to find the pixels. So lets say I set the variable to be "websiteLoaded" and I put the text as "True", if the "Wait for Pixels" action can't find the website because it didn't load then I want it to change the variable from "True" to "False". I was wanting to know how I can get this done if I'm doing it wrong such as setting the variable to the wrong value or if I need to add another action or anything to accomplish this so that I can make my next steps in the task be if then blocks to tell it what to do in those cases. Thank you and I look forward to the replies.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Wait for Pixel and like actions confuse me on variable changes

Post by Oleg »

It works, I tested this
Look at my small example below
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Also you can simply copy task text and paste it into the task list.
Then you can see it in task editor.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1459598804
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DisableOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task58"
Hide=INTEGER|0
ID=INTEGER|-1450562816
LogOnAsUser=INTEGER|1
Name=STRING|"Test Wait for Pixels (full screen)"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""aaa"" with value ""true"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
linecount=STRING|"1"
varname=STRING|"aaa"
varvalue=STRING|"true"

[Actions\Action2]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action2\Params]
message=STRING|"{aaa}"
type=STRING|"3"

[Actions\Action3]
ActionID=STRING|"A_SCR_WAITFORPIXELS"
Enabled=INTEGER|-1
Name=STRING|"Wait for Pixels (full screen)"
Params=FOLDER

[Actions\Action3\Params]
altershot=STRING|"0"
caption=STRING|"1"
class=STRING|"0"
classexact=STRING|"0"
color0000=STRING|"$00000000"
comparemode=STRING|"0"
exact=STRING|"0"
findmode=STRING|"0"
infinity=STRING|"0"
monitor=STRING|"0"
pxcount=STRING|"1"
source=STRING|"1"
timeout=STRING|"5"
tolerance0000=STRING|"16"
usedesktop=STRING|"0"
useprimary=STRING|"1"
waitresult=STRING|"1"
waitresultvar=STRING|"aaa"
x0000=STRING|"65"
y0000=STRING|"198"

[Actions\Action4]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"Log Message"
Params=FOLDER

[Actions\Action4\Params]
message=STRING|"{aaa}"
type=STRING|"3"

Oleg Yershov
Zac
Posts: 18
Joined: Wed Feb 22, 2023 5:14 pm

Re: Wait for Pixel and like actions confuse me on variable changes

Post by Zac »

Thank you so much for your quick response to my question. Your example was exactly what I was looking for, I was creating the variables as global and local variables without declaring them within the actual task itself as an action. Your example has helped me a lot! Thank You! :D :D :D
Post Reply