"Wait" makes the script fail

Discuss RoboTask here
Post Reply
AnkitaHundal
Posts: 13
Joined: Mon Nov 01, 2010 8:15 am
Location: Canada

"Wait" makes the script fail

Post by AnkitaHundal »

Hi Oleg,

The wait for window option within a script always makes
my task to fail. The logs show an error stating that the
window could not be found,even when the window has
appeared on the screen. Somehow, it is not seeing the
screen come up.
I have selected hidden and child window watch and looking
for window to be activated and have incorporated a delay
in case the system takes some time to pull the screen up.
Something needs to be added or changed here?

Also, the scripts run when I initiate them manually,
however the when initiated by the scheduler, they always
seem to get stuck at some window and fail. It it
necessary for the Robotask window to be up? I understood
that it would anyhow initiate the tasks till the time it
is running locally on the machine.

Thanks
Ankita
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

"Wait" makes the script fail

Post by Oleg »

Probably you have to check the existence of window before "Wait for window" action.
Wait for window waits the specified action.
For example: you want to wait for window creation. If required window exists, the action will wait another window with same parameters.

See my example below:
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|304847758
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task957"
Hide=INTEGER|0
ID=INTEGER|1722185942
LocalVariables=STRING|"w"
LogOnAsUser=INTEGER|1
Name=STRING|"Wait For Window example"
OnErrorTaskID=INTEGER|0
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

[Actions\Action1]
ActionID=STRING|"A_WINDOW_CHECK"
Enabled=INTEGER|-1
Name=STRING|"Check for Window"
Params=FOLDER

[Actions\Action1\Params]
abortif=STRING|"0"
action=STRING|"1"
checkfor=STRING|"0"
exact=STRING|"0"
variable=STRING|"w"
wincaption=STRING|"Registry Editor"

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

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

[Actions\Action3]
ActionID=STRING|"A_WAIT_FOR_WINDOW"
Enabled=INTEGER|-1
Name=STRING|"Wait For Window"
Params=FOLDER

[Actions\Action3\Params]
assignvariable=STRING|"0"
child=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
hidden=STRING|"0"
infinity=STRING|"0"
timeout=STRING|"60"
usecaption=STRING|"1"
useclass=STRING|"0"
watchfor=STRING|"1"
wincaption=STRING|"Registry Editor"

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

[Actions\Action5]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""[{Time}, {DayOfWeek}, {Date}]"""
Params=FOLDER

[Actions\Action5\Params]
icon=STRING|"1"
msg0=STRING|"[{Time}, {DayOfWeek}, {Date}]"
msg1=STRING|"Window exists"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"
AnkitaHundal
Posts: 13
Joined: Mon Nov 01, 2010 8:15 am
Location: Canada

"Wait" makes the script fail

Post by AnkitaHundal »

Got it!
Thanks!
Post Reply