Skip to content

Commit

Permalink
update applescript for exporting albums
Browse files Browse the repository at this point in the history
  • Loading branch information
Joseph Gill authored and Joseph Gill committed Mar 7, 2020
1 parent eec58c0 commit 492a5b7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion macOS-photos-export-albums.applescript
Original file line number Diff line number Diff line change
Expand Up @@ -136,12 +136,16 @@ on renameOutput(baseFolder, photoTitle, photoFilename, targetExtension)
set inFileNameNoExt to text 1 thru (lastDotIdx - 1) of photoFilename
set inFileNameBeforeExt to text lastDotIdx thru -1 of photoFilename
set inFileName to inFileNameNoExt & "." & targetExtension
log "photoFilename: " & photoFilename
-- log "inFileNameNoExt: " & inFileNameNoExt
-- log "inFileNameBeforeExt: " & inFileNameBeforeExt

-- original file path
set inFilePath to baseFolder & ":" & inFileName
set inFile to file inFilePath

set defaultFileName to inFileNameBeforeExt & "." & targetExtension
set defaultFileName to inFileNameNoExt & "." & targetExtension
log "defaultFileName: " & defaultFileName

-- only rename if the title is not empty
if (photoTitle is not missing value) then
Expand All @@ -157,6 +161,7 @@ on renameOutput(baseFolder, photoTitle, photoFilename, targetExtension)
-- set name of fpOrig to fpNew
set name of file inFileName of folder baseFolder to outFileName

log "new photo title: " & outFileName
return outFileName
else
log "photo has empty title: " & photoFilename
Expand All @@ -167,6 +172,7 @@ on renameOutput(baseFolder, photoTitle, photoFilename, targetExtension)
return defaultFileName
end if

-- dummy return for function to work
return defaultFileName

end tell
Expand Down

0 comments on commit 492a5b7

Please sign in to comment.