Folder activity

Discuss RoboTask here
Post Reply
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Folder activity

Post by steph@vds »

Hi,
I try to create a new task that can notify me if all items in a specified folder are rendered and then start another task.
I use After Effects to create animations.
My purpose is to ask Robotask if the rendering in After Effects is over.
The only solution I found is to create a loop that looks if the last
item to render is free (with the system variable
{IsFileFree({LASTFILE})} ).
(I can know what file will be the last to render)
It works but I wonder if a simplier solution exists because I have to
create a loop with 50000 iterations plus a pause to be sure that my
loop will execute for a long time (the time for rendering).
Is it a way to loop a task until a variable get a True value ?
I wanted my task to stop when the variable {IsFileFree({LASTFILE})} returns a True value.

The ideal solution will be to know if there is no more activity in a
specified folder : for example if I have 10 animations to render in a
folder "Rendered Files", I will know that the rendering is over if
there is no more activity in this folder.
Moreover this ideal solution would be usefull to know if my client has
finished his upload in my FTP site (if there is no more activity in a
FTP folder) or such other things.

Here is my task :

;**********************
;* RoboTask Task file *
;* Do not edit!       *
;**********************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1789981768
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task37"
Hide=INTEGER|0
ID=INTEGER|707182475
Name=STRING|"Rendering finished ?"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action10=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 variable ""LASTFILE"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"LASTFILE"

[Actions\Action10]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rendering finished !"""
Params=FOLDER

[Actions\Action10\Params]
icon=STRING|"1"
msg0=STRING|"Rendering finished !"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Open Dialog"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"What will be your last item to render ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"LASTFILE"

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

[Actions\Action3\Params]
begin=STRING|"1"
end=STRING|"10"

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

[Actions\Action4\Params]
delay=STRING|"50"

[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|"{IsFileFree({LASTFILE})}"

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

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

[Actions\Action8]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"LASTFILE exists"
Params=FOLDER

[Actions\Action8\Params]
message=STRING|"{IsFileFree({LASTFILE})}"
type=STRING|"0"

[Actions\Action9]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""LASTFILE"""
Params=FOLDER

[Actions\Action9\Params]
varname=STRING|"LASTFILE"


Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Folder activity

Post by Oleg »

There is Break action to terminate the loop. You mistook: you should interchange End Loop and End if actions.

I've improved your task (see below).

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

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task360"
Hide=INTEGER|0
ID=INTEGER|707182475
Name=STRING|"Rendering finished ? (improved)"
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_VARIABLES_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create variable ""LASTFILE"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"LASTFILE"

[Actions\Action10]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""LASTFILE"""
Params=FOLDER

[Actions\Action10\Params]
varname=STRING|"LASTFILE"

[Actions\Action11]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rendering finished !"""
Params=FOLDER

[Actions\Action11\Params]
icon=STRING|"1"
msg0=STRING|"Rendering finished !"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Open Dialog"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"What will be your last item to render ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"LASTFILE"

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

[Actions\Action3\Params]
begin=STRING|"1"
end=STRING|"10"

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

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsFileFree({LASTFILE})}"

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

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

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

[Actions\Action7\Params]
delay=STRING|"50"

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

[Actions\Action9]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"LASTFILE exists"
Params=FOLDER

[Actions\Action9\Params]
message=STRING|"{IsFileFree({LASTFILE})}"
type=STRING|"0"
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Folder activity

Post by steph@vds »

Hi Oleg,

Your task works well but my problem is still the same. When my render
is not finished and the loop has loops 10 times, despite the False
value of my {IsFileFree({LASTFILE})} it returns me the message
"Rendering finished !"
I could enter a very big value in the "To" field (like 1000000) to
ensure that the loop will execute indefinitly. This is an empiric
method. Perhaps a very good one ?
The Simple Loop allows to loop over a number of iterations but how to loop indefinitly until a value has changed ?
Maybe the Simple Loop is not the good way to do this ?
And what do you think about "Folder Activity" ?

However this software is very great. I'm working on it with passion for one week !
Regards.
Steph.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Folder activity

Post by Oleg »

Did you try my example? I think no. I've tested it, it works fine.
My improvements are:
- interchanged "End Loop" and "End if" actions
- set up the "If value is" parameter to TRUE (in "If..Then" action)
- put "Break" action between "If Then" and "End if" actions.
- moved "Pause" action to end of loop
Last edited by Oleg on Thu Dec 15, 2005 7:51 am, edited 1 time in total.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Folder activity

Post by steph@vds »

Yes I tried it and I understood your improvments.
Indeed this is more logic to have interchanged "End Loop" and "End if" like you did.
The "If value is" = True forces the Break operation.
But when the loop has iterated 10 times the task executes the steps after the "End loop".

That's the behaviour of your task on my PC.

Do you have the same behaviour ?

Steph.

Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Folder activity

Post by Oleg »

See another example. It displays an error message "Rendering is NOT finished !" if your file not free after timeout. You can increase timeout freely ("To" field in the loop).

You need one more checking IsFileFree after loop

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

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task360"
Hide=INTEGER|0
ID=INTEGER|707182475
Name=STRING|"Rendering finished 1 ? (improved)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

[Actions]
Action1=FOLDER
Action10=FOLDER
Action11=FOLDER
Action12=FOLDER
Action13=FOLDER
Action14=FOLDER
Action15=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 variable ""LASTFILE"" with value """""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"LASTFILE"

[Actions\Action10]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rendering finished !"""
Params=FOLDER

[Actions\Action10\Params]
icon=STRING|"1"
msg0=STRING|"Rendering finished !"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action12]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rendering is NOT finished !"""
Params=FOLDER

[Actions\Action12\Params]
icon=STRING|"3"
msg0=STRING|"Rendering is NOT finished !"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action14]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"LASTFILE exists"
Params=FOLDER

[Actions\Action14\Params]
message=STRING|"{IsFileFree({LASTFILE})}"
type=STRING|"0"

[Actions\Action15]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""LASTFILE"""
Params=FOLDER

[Actions\Action15\Params]
varname=STRING|"LASTFILE"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Open Dialog"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"What will be your last item to render ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"LASTFILE"

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

[Actions\Action3\Params]
begin=STRING|"1"
end=STRING|"10"

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

[Actions\Action4\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsFileFree({LASTFILE})}"

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

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

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

[Actions\Action7\Params]
delay=STRING|"50"

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

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

[Actions\Action9\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{IsFileFree({LASTFILE})}"



Last edited by Oleg on Thu Dec 15, 2005 8:06 am, edited 1 time in total.
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Folder activity

Post by steph@vds »

Oleg,

I guess that you let me know the empiric method (with a great value in
the "To" field) is the good way to loop indefinitely. It's ok for me !

Thanks.

P.S : concerning the "Folder Activity", I will try to do some tasks to
simulate it. It's not a simple work for me but it's very interesting.
Oleg
Site Admin
Posts: 3014
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Folder activity

Post by Oleg »

Excuse me, I forgot about Wait for File action. This action waits until specified file will be available. Your task will be simpler. See below.

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

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|0
CatID=INTEGER|1614811947
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task348"
Hide=INTEGER|0
ID=INTEGER|964997929
Name=STRING|"Rendering finished (wait for file)"
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3

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

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

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"LASTFILE"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_OPEN"
Enabled=INTEGER|-1
Name=STRING|"Open Dialog"
Params=FOLDER

[Actions\Action2\Params]
caption=STRING|"What will be your last item to render ?"
default=STRING|"None"
filter=STRING|"Text files|*.txt|All files|*.*|"
variable=STRING|"LASTFILE"

[Actions\Action3]
ActionID=STRING|"A_FILE_WAIT"
Enabled=INTEGER|-1
Name=STRING|"Waiting {LASTFILE} file for 120 sec"
Params=FOLDER

[Actions\Action3\Params]
filename=STRING|"{LASTFILE}"
timeout=STRING|"120"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Rendering finished !"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"Rendering finished !"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

[Actions\Action5]
ActionID=STRING|"A_ROBOTASK_LOG"
Enabled=INTEGER|-1
Name=STRING|"LASTFILE exists"
Params=FOLDER

[Actions\Action5\Params]
message=STRING|"{IsFileFree({LASTFILE})}"
type=STRING|"0"

[Actions\Action6]
ActionID=STRING|"A_VARIABLES_REMOVE"
Enabled=INTEGER|-1
Name=STRING|"Remove variable ""LASTFILE"""
Params=FOLDER

[Actions\Action6\Params]
varname=STRING|"LASTFILE"
steph@vds
Posts: 46
Joined: Tue Nov 29, 2005 11:27 pm
Location: France

Folder activity

Post by steph@vds »

Hi Oleg,

Your task works fine.
However there is a slight difference between the "Wait File" method and
the "IsFileFree" method. The first one is easier to use but doesn't
work with files that don't exist. It's normal.
The second one is more complex to set but has an advantage : it works
with files that don't yet exist. Indeed when the file is not existing,
the "IsFileFree" system parameter returns a False value. It could be
usefull in some cases like mine.

Thanks for you precious help.

Steph.
Post Reply