Re: Do-While Loop

Discuss RoboTask here
Post Reply
MatCh
Posts: 3
Joined: Tue Aug 30, 2005 9:54 pm
Location: Singapore

Re: Do-While Loop

Post by MatCh »

I need to do something like this:

Wait for WindowActive"t1.doc - Microsoft Word"
Abort Task TimeOut = 20sec

Something like that.
I can't figure out which loop or action can do that, or is there a work around for it?

I think it could have been something like:

Do

delay = 500msec


while WinActive"t1.doc - Microsoft Word" = False

Last edited by MatCh on Wed Aug 31, 2005 9:30 pm, edited 1 time in total.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Do-While Loop

Post by Oleg »

Try the example below. This task waits for activation of window "Notepad" during 20s (100 loops by 0.2s) and informs you if the window will be activated. If the window remains inactive you get a message "Window Notepad still not active"

We are planning to add such actions as "Wait for window", "wait for file".
Regarding to "While ... loop" and "Loop ... until" actions. It's a good idea. I wrote this into our ToDo list.

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|565106205
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task298"
Hide=INTEGER|0
ID=INTEGER|500632595
Name=STRING|"Wait for window active"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

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

[Actions\Action1]
ActionID=STRING|"A_LOOP_SIMPLE"
Enabled=INTEGER|-1
Name=STRING|"Simple Loop"
Params=FOLDER

[Actions\Action1\Params]
begin=STRING|"1"
end=STRING|"100"
variable=STRING|"W_CNT"

[Actions\Action10]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Window ""Notepad"" still not active"""
Params=FOLDER

[Actions\Action10\Params]
icon=STRING|"0"
msg0=STRING|"Window ""Notepad"" still not active"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

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

[Actions\Action2\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsWindowActive(Notepad)}"

[Actions\Action3]
ActionID=STRING|"A_LOOP_BREAK"
Enabled=INTEGER|-1
Name=STRING|"Break"

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

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

[Actions\Action5\Params]
delay=STRING|"2"

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

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

[Actions\Action7\Params]
case=STRING|"0"
operator=STRING|"5"
type=STRING|"1"
value1=STRING|"{w_cnt}"
value2=STRING|"100"

[Actions\Action8]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Window ""Notepad"" is active"""
Params=FOLDER

[Actions\Action8\Params]
icon=STRING|"1"
msg0=STRING|"Window ""Notepad"" is active"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action9]
ActionID=STRING|"A_FLOW_ELSE"
Enabled=INTEGER|-1
Name=STRING|"Else"
Post Reply