Problems with Wait for Window
Posted: Wed Nov 19, 2008 1:33 pm
I seem to have run across a corner case where Wait for Window/Check for Window/{Window Exists()} doesn't work. I have two tasks- Scratch and Scratch2. Scratch executes an internal Basic script and then launches Scratch2. Scratch2 then executes a Wait for Window. But the task never proceeds, no matter how many times the window appears. If I either uncheck the Basic script in Scratch or just launch Scratch2 directly, the Wait for Window works without any problems. If I try to use and If/Then statement with {WindowExists()} then RoboTask stops responsing and I have to restart the whole program.
I'm using 3.2.1 with both patches applied on Windows Vista 32-bit. I've copied Scratch and Scratch2 using Notepad for the Wait for Window below for reference.
Please help with this- it is a showstopper.
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1221978872
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task4"
Hide=INTEGER|0
ID=INTEGER|1109131958
Name=STRING|"Scratch"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
[Actions\Action1]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Internal basic script"
Params=FOLDER
[Actions\Action1\Params]
line00000=STRING|"Sub Main"
line00003=STRING|"End Sub"
linecount=STRING|"4"
source=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_TASKS_START"
Enabled=INTEGER|-1
Name=STRING|"Start Task ""Scratch2"""
Params=FOLDER
[Actions\Action2\Params]
taskid=STRING|"677512167"
wait=STRING|"1"
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1221978872
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task7"
Hide=INTEGER|0
ID=INTEGER|677512167
Name=STRING|"Scratch2"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
[Actions\Action1]
ActionID=STRING|"A_WAIT_FOR_WINDOW"
Enabled=INTEGER|-1
Name=STRING|"Wait For Window"
Params=FOLDER
[Actions\Action1\Params]
assignvariable=STRING|"0"
child=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
hidden=STRING|"0"
infinity=STRING|"0"
timeout=STRING|"10"
usecaption=STRING|"1"
useclass=STRING|"0"
watchfor=STRING|"1"
wincaption=STRING|"Untitled - Notepad"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|0
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{WindowExists(Untitled - Notepad)}"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""WindowExists worked"""
Params=FOLDER
[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"WindowExists worked"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|0
Name=STRING|"End If"
I'm using 3.2.1 with both patches applied on Windows Vista 32-bit. I've copied Scratch and Scratch2 using Notepad for the Wait for Window below for reference.
Please help with this- it is a showstopper.
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1221978872
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task4"
Hide=INTEGER|0
ID=INTEGER|1109131958
Name=STRING|"Scratch"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
[Actions\Action1]
ActionID=STRING|"BASIC_SCRIPT"
Enabled=INTEGER|-1
Name=STRING|"Internal basic script"
Params=FOLDER
[Actions\Action1\Params]
line00000=STRING|"Sub Main"
line00003=STRING|"End Sub"
linecount=STRING|"4"
source=STRING|"0"
[Actions\Action2]
ActionID=STRING|"A_TASKS_START"
Enabled=INTEGER|-1
Name=STRING|"Start Task ""Scratch2"""
Params=FOLDER
[Actions\Action2\Params]
taskid=STRING|"677512167"
wait=STRING|"1"
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1221978872
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task7"
Hide=INTEGER|0
ID=INTEGER|677512167
Name=STRING|"Scratch2"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
Action2=FOLDER
Action3=FOLDER
Action4=FOLDER
[Actions\Action1]
ActionID=STRING|"A_WAIT_FOR_WINDOW"
Enabled=INTEGER|-1
Name=STRING|"Wait For Window"
Params=FOLDER
[Actions\Action1\Params]
assignvariable=STRING|"0"
child=STRING|"0"
classexact=STRING|"0"
exact=STRING|"0"
hidden=STRING|"0"
infinity=STRING|"0"
timeout=STRING|"10"
usecaption=STRING|"1"
useclass=STRING|"0"
watchfor=STRING|"1"
wincaption=STRING|"Untitled - Notepad"
[Actions\Action2]
ActionID=STRING|"A_FLOW_IF"
Enabled=INTEGER|0
Name=STRING|"If Then"
Params=FOLDER
[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{WindowExists(Untitled - Notepad)}"
[Actions\Action3]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|0
Name=STRING|"Show ""WindowExists worked"""
Params=FOLDER
[Actions\Action3\Params]
icon=STRING|"1"
msg0=STRING|"WindowExists worked"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
[Actions\Action4]
ActionID=STRING|"A_FLOW_ENDIF"
Enabled=INTEGER|0
Name=STRING|"End If"