Hello,
I want to automatically rename files into a specific folder. I am capturing video files and I want to rename them using a script. I am building the string for each file like name of the series, season and I want to use a text file for the titles.
the text file should look like this with the titles of each episode using enter als the delimiter:
Pilot
Landing
Stop
I already created the script and it renames the files but just with values from an input form or static. So how can I read in a loop one line, put it into the string and then going to the next file.
This is my code at the moment.
set episodefolder to choose folder
display dialog "Name of the Series" default answer ""
set seriesname to text returned of result
display dialog "Which Season" default answer ""
set Season to text returned of result
tell application "Finder"
set numbering to the count of document files of the folder episodefolder
set filename to every document file of the folder episodefolder
repeat with numberid from 1 to numbering
set currentfile to item numberid of filename
if numberid ≤ 9 then
set the name of currentfile to (seriesname & "-" & "S0" & Season & "E0" & (numberid as string) & "." & name extension of currentfile)
else
set the name of currentfile to (seriesname & "-" & "S0" & Season & "E" & (numberid as string) & "." & name extension of currentfile)
end if
end repeat
end tell