How to modify Automator Script (app) to rename MOV with date and time?
Here's my issue. First, I am thrilled to have found an Automator script written and posted by VikingOSX here:
Script to rename pictures with date and t… - Apple Community
....Which totally works... in renaming HEIC and JPEG images to their EXIF date and time data.
(I tried to reply there in the Community thread where the original functional script was posted, but that was not permitted.)
However, I also need to rename .MOV files too.
Now, VikingOSX's instructions were excellent. However, in order to get his automator script (app) to work, I had to do one more step. When VikingOSX wrote:
Then one drags and drops the following actions from their respective Library (in order) to the larger workflow window:
1. Files & Folders > Ask for Finder Items
2. Utilities > Run AppleScript
On that first one, I had to change the "Type" from "Files" to "Folders" as shown:
Before:
Choosing:
After:
Could someone, perhaps even @VikingOSX, advise me on how to revise the script to also rename .MOV files?
Here's the original script:
property imageKind : {"HEIF Image", "JPEG image"}
property app_icon : "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/MultipleItemsIcon.icns"property imageCnt : (0 as integer)
on run {input, parameters}
set parentdir to input
set EXIFTOOL to (do shell script "PATH=\"/usr/local/bin:/opt/homebrew/bin:$PATH\";/usr/bin/which exiftool")
tell application "Finder"
set img_list to (every item in entire contents of folder parentdir whose kind is in imageKind) as alias list
if img_list = {} then
display alert "No images found" return
end if
repeat with anImage in img_list
set EXT to "." & anImage's name extension
set DTO_string to (do shell script EXIFTOOL & " -s3 -d \"%F %H-%M-%S\" -DateTimeOriginal " & (POSIX path of anImage)'s quoted form)
if not DTO_string = "" then
set outFile to ((parentdir as text) & DTO_string & EXT) as text
set basename to (do shell script "basename " & (outFile's quoted form)'s POSIX path)
set name of anImage to basename
set imageCnt to imageCnt + (1 as integer)
else
log "NO-OP"
end if
end repeat
end tell
display dialog "Processed image count: " & (imageCnt as text) with title "Processing complete" with icon POSIX file app_icon as alias
returnend run
MacBook Pro 16″, macOS 13.6