If Then / FileExists / List File

Discuss RoboTask here
Post Reply
lordgrinz
Posts: 7
Joined: Fri Jul 22, 2011 5:21 pm
Location: United States

If Then / FileExists / List File

Post by lordgrinz »

I am trying to use the following statement utilizing a filelist, it only works if there is only one file listed in the filelist. This is a check before I send an email containing attachments from this filelist. Is there a way to make this check work on all files in the list?{FileExists({TextFile({cFileList})})}
lordgrinz
Posts: 7
Joined: Fri Jul 22, 2011 5:21 pm
Location: United States

If Then / FileExists / List File

Post by lordgrinz »

I should have mentioned I am using an "If Then" statement and a Boolean for a an if value is "True".
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If Then / FileExists / List File

Post by Oleg »

You can create the list of existing files by "Search for Files" action.
Next you can specify as attachment the following expression:
{TextFile(file_name)}
where file_name is the full name of created text file.
lordgrinz
Posts: 7
Joined: Fri Jul 22, 2011 5:21 pm
Location: United States

If Then / FileExists / List File

Post by lordgrinz »

Oleg wrote:You can create the list of existing files by "Search for Files" action.
Next you can specify as attachment the following expression:
{TextFile(file_name)}
where file_name is the full name of created text file.
I've done that, but I am trying to do an IF THEN boolean check against the filelist, before sending the email. Like the following IF {FileExists({TextFile({cFileList})})} = True THEN ....run actionsProblem is that the FileExists function won't run against a filelist
Oleg
Site Admin
Posts: 3202
Joined: Thu Jan 01, 1970 1:00 am
Contact:

If Then / FileExists / List File

Post by Oleg »

Regarding to {FileExists()} variable
You should use only file name as parameter, like this:
{FileExists(C:\temp\file.tmp)}
or variable which contains single file name
{FileExists({MyFile})}
you can't use the list of filenames. If you have the list you should process it in the text loop

Regarding to your task:
I think that you don't need to uese {FileExists()} variable. See the example below:

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************

[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|1005538731
Comment=STRINGLIST
ContinueOnError=INTEGER|0
ExternalName=STRING|"Task1081"
Hide=INTEGER|0
ID=INTEGER|1670688694
LocalVariables=STRING|"filelist"
LogOnAsUser=INTEGER|1
Name=STRING|"Send files in folder"
OnErrorTaskID=INTEGER|0
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0

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

[Actions\Action1]
ActionID=STRING|"A_FILE_DELETE"
Enabled=INTEGER|-1
Name=STRING|"Delete File"
Params=FOLDER

[Actions\Action1\Params]
Count=STRING|"1"
deletedirs=STRING|"0"
file0=STRING|"c:\temp\list.txt"
hidden=STRING|"1"
subdir=STRING|"0"
system=STRING|"1"
ToRecycleBin=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (c:\temp\list.txt)"
Params=FOLDER

[Actions\Action2\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20110725"
date2=STRING|"20110725"
destfile=STRING|"c:\temp\list.txt"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"c:\incoming\*.abc"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
searchkind=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

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

[Actions\Action3\Params]
case=STRING|"0"
operator=STRING|"7"
type=STRING|"0"
value1=STRING|"{TextFile(c:\temp\list.txt)}"

[Actions\Action4]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""File list is empty!!!!"""
Params=FOLDER

[Actions\Action4\Params]
icon=STRING|"1"
msg0=STRING|"File list is empty!!!!"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"

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

[Actions\Action6]
ActionID=STRING|"A_INET_SENDMAIL"
Enabled=INTEGER|-1
Name=STRING|"Send Email"
Params=FOLDER

[Actions\Action6\Params]
attach0=STRING|"{TextFile(c:\temp\list.txt)}"
attachcount=STRING|"1"
auth=STRING|"0"
charset=STRING|"iso-8859-1"
from=STRING|"user@domain.com"
host=STRING|"localhost"
html=STRING|"0"
msg0=STRING|"See files in attachment"
msgcount=STRING|"1"
port=STRING|"25"
SSL=STRING|"0"
subject=STRING|"Files"
to=STRING|"user1@domain.com"

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