Trying to use file loop

Discuss RoboTask here
Post Reply
DanMcKinney
Posts: 7
Joined: Sun Aug 18, 2019 10:40 pm

Trying to use file loop

Post by DanMcKinney »

I am trying to put together a little routine that will look through a folder of photos, grab the metadata "Title" for each photo, create folders named after the various metadata chunks, and move the photos into the new folders. So, each photo will be organized into a folder named after the title found in the metadata.

I can get Robotask to retrieve the metadata "Title" from a specific file, assign it to a variable, and then create a folder named after that variable. Works fine. But I don't know how to create a file loop that will repeat these actions. Whenever I try to put any actions in a file loop, they don't seem to be executed.

Maybe I don't understand how "file loop" works, but it seems to me as if it ought to go through the folder, and perform actions on each file, one by one, until all the files have been processed. Is that right...?

Code: Select all

;*****************************
;* RoboTask Task file
;* Do not edit in text editor!
;*****************************
 
[Root]
ActionAfterRun=INTEGER|0
Actions=FOLDER
Automat=INTEGER|-1
CatID=INTEGER|0
Comment=STRINGLIST
ContinueOnError=INTEGER|0
DoNotStopWhenShutdown=INTEGER|0
ExternalName=STRING|"Task4"
Hide=INTEGER|0
ID=INTEGER|-1181510704
LocalVariables=STRING|"""CURRENTFILE=not set"",TITLE="
LogOnAsUser=INTEGER|1
Name=STRING|"Organize into folders by metadata ""title"""
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
Action3=FOLDER
Action4=FOLDER

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

[Actions\Action1\Params]
createmode=STRING|"1"
date1=STRING|"20200421"
date2=STRING|"20200421"
destvar=STRING|"CURRENTFILE"
DuringDays=STRING|"1"
DuringHours=STRING|"1"
DuringMinutes=STRING|"1"
DuringMonths=STRING|"1"
file0=STRING|"D:\new virtual tour\resized for slideshow\"
filecount=STRING|"1"
OlderDays=STRING|"1"
OlderHours=STRING|"1"
OlderMinutes=STRING|"1"
OlderMonths=STRING|"1"
savesize=STRING|"0"
searchkind=STRING|"0"
sort=STRING|"1"
sortby=STRING|"0"
sortorder=STRING|"0"
subdirs=STRING|"0"
timesize=STRING|"0"
WithoutPath=STRING|"0"

[Actions\Action2]
ActionID=STRING|"A_GETMETADATA"
Enabled=INTEGER|-1
Name=STRING|"Get File Metadata from file {CURRENTFILE}"
Params=FOLDER

[Actions\Action2\Params]
filename=STRING|"{CURRENTFILE}"
prop00000000=STRING|"Title"
propcount=STRING|"1"
var00000000=STRING|"TITLE"

[Actions\Action3]
ActionID=STRING|"A_FOLDER_CREATE"
Enabled=INTEGER|-1
Name=STRING|"Create Folder ({TITLE})"
Params=FOLDER

[Actions\Action3\Params]
newfolder=STRING|"{TITLE}"

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

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

Re: Trying to use file loop

Post by Oleg »

  1. Look at the step #1. I think you forgot the file mask for example *.jpg or some else
  2. Look at the step #3 (create folder). You want create a folder (or subfolder). Where? You don't know your current folder.
    I think that you have to specify full path. This is simplest way.
    For example: D:\new virtual tour\resized for slideshow\{ValidFileName({TITLE})}
    I strongly recommend you to use ValidFileName variable, because the title can contain prohibited symbols. You will get the error in this case.
  3. Title can be empty or contain spaces only. What do you want to do in this case? Such folder name is invalid
Oleg Yershov
DanMcKinney
Posts: 7
Joined: Sun Aug 18, 2019 10:40 pm

Re: Trying to use file loop

Post by DanMcKinney »

Thanks for the help! Figured out what I was doing wrong with the loop. Great product, Oleg, just takes me time to puzzle this stuff out.
Post Reply