Page 1 of 1
Get filename of file which triggered file monitor
Posted: Thu Jul 30, 2015 9:45 am
by userXXX
Hello,
file monitor is working fine and the task starts immediately after a new file was copied into a folder.
My question:
How can I access the filename of the new file inside the task?
I tried this way but {L_TEST} is always empty inside the task:

- robo.gif (6.33 KiB) Viewed 15459 times
Any suggestions?
Thank you.
Re: Get filename of file which triggered file monitor
Posted: Thu Jul 30, 2015 10:48 am
by Oleg
Look at my example below
Code: Select all
;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|317955339
Comment=STRINGLIST
ContinueOnError=INTEGER|0
Events=FOLDER
ExternalName=STRING|"Task1285"
Hide=INTEGER|0
ID=INTEGER|118615438
LogOnAsUser=INTEGER|1
Name=STRING|"File monitoir with parameter"
OnErrorTaskID=INTEGER|-1
Priority=INTEGER|3
RunOnClose=INTEGER|0
RunOnStartup=INTEGER|0
ToLog=INTEGER|3
WriteGeneralLog=INTEGER|0
[Actions]
Action1=FOLDER
[Actions\Action1]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""New files are:"""
Params=FOLDER
[Actions\Action1\Params]
icon=STRING|"1"
msg0=STRING|"New files are:"
msg1=STRING|"{newfiles}"
msg3=STRING|"Deleted files are:"
msg4=STRING|"{delfiles}"
msg6=STRING|"Changed files:"
msg7=STRING|"{chfiles}"
msgcount=STRING|"8"
playsound=STRING|"0"
showmessage=STRING|"1"
[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"
chglistparameter=STRING|"chfiles"
chgsl=STRING|"1"
chgsm=STRING|"1"
chgtl=STRING|"1"
chgtm=STRING|"1"
del=STRING|"1"
dellistparameter=STRING|"delfiles"
folder1=STRING|"d:\dest"
foldercount=STRING|"1"
incmask=STRING|"*.*"
interval=STRING|"5"
listmode=STRING|"1"
mon_files=STRING|"1"
mon_folders=STRING|"0"
new=STRING|"1"
newlistparameter=STRING|"newfiles"
pass=STRING|"1"
passmode=STRING|"2"
saveresults=STRING|"0"
subfolders1=STRING|"1"
In your example I see that you pass only the list of
NEW files. Maybe the problem is here?
These parameters contains the list of files as text: one name per line
Re: Get filename of file which triggered file monitor
Posted: Thu Jul 30, 2015 11:13 am
by userXXX
Thank you, Oleg.
>>In your example I see that you pass only the list of NEW files. Maybe the problem is here?
No, this works fine.
The reason was:
I additionally declared these parameters as local variables, too.
No good idea...

Re: Get filename of file which triggered file monitor
Posted: Thu Jul 30, 2015 12:27 pm
by Oleg
additionally declared these parameters as local variables, too.
You do not need to declare variables. It's enough to pass some parameters and you can use them as variables.