Wait for new file from here - If excist, run script further?

Discuss RoboTask here
Post Reply
snowseals
Posts: 59
Joined: Mon Apr 11, 2016 10:17 am

Wait for new file from here - If excist, run script further?

Post by snowseals »

How do I create a script that Waits for a new file to be saved in a specific folder?
And when it does excist, then proceed with the script?

Note:
I'm trying to let the script run further auto-pilot, after I saved a document.
This document always ends up in same folder, but with different names.
Extension is .docx
After it's been saved (a new file therefor), the script should proceed.
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Wait for new file from here - If excist, run script furt

Post by Oleg »

Use File Monitor trigger
It can monitor new files by mask and start the task
Oleg Yershov
snowseals
Posts: 59
Joined: Mon Apr 11, 2016 10:17 am

Re: Wait for new file from here - If excist, run script furt

Post by snowseals »

I was looking under Actions instead of Triggering Events, Thanks!
Works ;)
Oleg
Site Admin
Posts: 3000
Joined: Thu Jan 01, 1970 1:00 am
Contact:

Re: Wait for new file from here - If excist, run script furt

Post by Oleg »

Look at this example below.
It waits for existence of the file for 1 minute

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|444033236
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task105"
Hide=INTEGER|0
ID=INTEGER|-1457413517
LogOnAsUser=INTEGER|1
Name=STRING|"Wait for file"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
UnicodeFormat=INTEGER|1
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_VARIABLES_SET"
Enabled=INTEGER|-1
Name=STRING|"Set variable ""FILENAME"" with value ""c:\incoming\test.txt"""
Params=FOLDER

[Actions\Action1\Params]
expand=STRING|"0"
varname=STRING|"FILENAME"
varvalue=STRING|"c:\incoming\test.txt"

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

[Actions\Action11]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""Timeout error"""
Params=FOLDER

[Actions\Action11\Params]
icon=STRING|"3"
msg0=STRING|"Timeout error"
msg1=STRING|"File {FileName} doesn't exist!"
msgcount=STRING|"2"
playsound=STRING|"0"
showmessage=STRING|"1"

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

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

[Actions\Action2\Params]
begin=STRING|"1"
end=STRING|"60"

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

[Actions\Action3\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists({FileName})}"

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

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

[Actions\Action6]
ActionID=STRING|"A_GENERAL_PAUSE"
Enabled=INTEGER|-1
Name=STRING|"Delay 1 sec"
Params=FOLDER

[Actions\Action6\Params]
delay=STRING|"1"
dimension=STRING|"1"

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

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

[Actions\Action8\Params]
case=STRING|"0"
connection=STRING|"0"
count=STRING|"1"
operator=STRING|"0"
type=STRING|"3"
value1=STRING|"{FileExists({FileName})}"

[Actions\Action9]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File {FileName} exists!"""
Params=FOLDER

[Actions\Action9\Params]
icon=STRING|"1"
msg0=STRING|"File {FileName} exists!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

Oleg Yershov
Post Reply