Search for Files - Create File List save empty variable

Discuss RoboTask here
Post Reply
gabageno
Posts: 1
Joined: Tue Jul 05, 2016 2:42 pm

Search for Files - Create File List save empty variable

Post by gabageno »

Hi, I'm trying to read the list of files in a folder and then do actions for each filename.
I use the "Search for files" action. I give them the path and wildcard to filter files. Set "Save the File list to Variable" option and add another action to show the variable content in a dialog. But when I run the task the dialog box is empty.
I've used others ways to try to know the content of the variable but always is empty.
If I use the option "Save the List to File" then the file is created with the correct content of the folder.
Why I can´t get this in a variable???

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

Re: Search for Files - Create File List save empty variable

Post by Oleg »

maybe you are doing some wrong.
Look at my example below (only two steps). It works

Code: Select all

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

[Actions]
Action1=FOLDER
Action2=FOLDER

[Actions\Action1]
ActionID=STRING|"A_FILE_SEARCH"
Enabled=INTEGER|-1
Name=STRING|"Create File List (variable: myvar)"
Params=FOLDER

[Actions\Action1\Params]
After=STRING|"0"
aftercount=STRING|"0"
AfterLine=STRING|"0"
Before=STRING|"0"
beforecount=STRING|"0"
BeforeLine=STRING|"0"
createmode=STRING|"1"
date1=STRING|"20160705"
date2=STRING|"20160705"
destvar=STRING|"myvar"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"c:\temp\*.txt"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savetofile=STRING|"0"
savetovar=STRING|"1"
searchkind=STRING|"0"
sort=STRING|"0"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"1"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_DIALOG_MESSAGE"
Enabled=INTEGER|-1
Name=STRING|"Show ""{myvar}"""
Params=FOLDER

[Actions\Action2\Params]
icon=STRING|"1"
msg0=STRING|"{myvar}"
msgcount=STRING|"1"
playsound=STRING|"0"
showmessage=STRING|"1"
Save the text of the task to a file and use menu Task->Import to import the task into RoboTask.
Oleg Yershov
Post Reply