Can i create a trigger - "wait for folder to become empty"

Discuss RoboTask here
Post Reply
leshemomer
Posts: 3
Joined: Mon Dec 08, 2014 10:42 am

Can i create a trigger - "wait for folder to become empty"

Post by leshemomer »

Hello,

Can i create a trigger which monitors a certain folder to activate a task when the folder becomes empty?

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

Re: Can i create a trigger - "wait for folder to become empt

Post by Oleg »

You can attach to the task File monitor trigger.

But you should check the amount of files in the folder in the task. See {FilesCount()} variable.
Algorithm is simple:

Code: Select all

if {FilesCount(c:\myfolder)} = 0 then
   .....
   do something
   .....
end if 
Thus, necessary actions will be performed only if the folder is empty.
Oleg Yershov
leshemomer
Posts: 3
Joined: Mon Dec 08, 2014 10:42 am

Re: Can i create a trigger - "wait for folder to become empt

Post by leshemomer »

Thanks! (:

where do I paste it?
could you maybe send a screenshot?
i'm not really sure how to use the IF

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

Re: Can i create a trigger - "wait for folder to become empt

Post by Oleg »

See the example of the task below.
Save the text of the task into a file and use menu Task->Import to import the task into RoboTask.
Do not forget to enable task after importing.

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1416408852
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task113"
Hide=INTEGER|0
ID=INTEGER|953625670
LogOnAsUser=INTEGER|1
Name=STRING|"Start main task if folder is empty"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

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

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

[Actions\Action1\Params]
case=STRING|"0"
operator=STRING|"0"
type=STRING|"1"
value1=STRING|"{FilesCount(c:\incoming)}"
value2=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_TASKS_START"
Enabled=INTEGER|-1
Name=STRING|"Start Main Task"
Params=FOLDER

[Actions\Action2\Params]
parametercount=STRING|"0"
taskid=STRING|"631126132"
wait=STRING|"0"

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

[Events]
Event1=FOLDER

[Events\Event1]
Enabled=INTEGER|-1
EventID=STRING|"E_FILE_MONITOR"
Params=FOLDER
UnigueID=INTEGER|16445953

[Events\Event1\Params]
chg=STRING|"1"
chga=STRING|"1"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"1"
folder1=STRING|"C:\incoming"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"15"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
pass=STRING|"0"
passmode=STRING|"1"
saveresults=STRING|"0"
subfolders1=STRING|"1"
Oleg Yershov
leshemomer
Posts: 3
Joined: Mon Dec 08, 2014 10:42 am

Re: Can i create a trigger - "wait for folder to become empt

Post by leshemomer »

Wow! That's GREAT
now I understand how it's supposed to be (:
thanks soo sooo much!

Omer
Post Reply