I'm very happy of my Nokia 6600 and I love iView Media Pro, especially for its excellent cataloguing tools. However, I was a little disappointed when I noticed that pictures shot with the mobile phone and transfered via Bluetooth to the Mac are given as creation date the date and time of transfer.
I was looking for a way to recover the original capture date, to be able to sort pictures correctly, so I cooked up -- borrowing extensively from the supplied scripts -- the following AppleScript. It updates the creation and modification dates of pictures using the data available in the caption field of the image metadata. You need Developer Tools installed because it relies on SetFile
To use, drop the script in the local Plug-Ins folder, which can be located (or created if necessary) in either of the following two locations:
on run
-- get the list of selected ID's in front window
set selectedItems to GetSelection()
-- show about
AboutScript()
-- process each item
repeat with theItem in selectedItems
tell application "iView MediaPro"
--get path to image
set PathToImgs to the path of theItem
--get caption of image
set theCaption to the caption of theItem
end tell
-- change caption to list
set captionlist to {}
copy every paragraph of theCaption to end of captionlist
set captionlist to first item of captionlist
--dates on my phone are stored as dd/mm/yyyy
--os x uses the american date format mm/dd/yyyy
--this routine formats the date correctly
set calendarDate to formatDate(item 4 of captionlist)
set theDate to calendarDate & " " & item 5 of captionlist
-- change path style from AppleScript to Unix
set AppleScript's text item delimiters to ":"
set PathToImgsUnix to {}
copy every text item of PathToImgs to end of PathToImgsUnix
set AppleScript's text item delimiters to "/"
set PathToImgsUnix to first item of PathToImgsUnix
set first item of PathToImgsUnix to ""
set PathToImgsUnix to PathToImgsUnix as string
-- build shell command and execute
set shellBatch to "bash -c "/Developer/Tools/SetFile"
--comment not to set the modification date:
set shellBatch to shellBatch & " -m \"" & theDate & "\""
set shellBatch to shellBatch & " -d \"" & theDate & "\""
set shellBatch to shellBatch & " \"" & PathToImgsUnix & "\""
set shellBatch to shellBatch & """
do shell script shellBatch
end repeat
end run
-- formats a date dd/mm/yyyy as mm/dd/yyyy -----------------------
on formatDate(aDate)
set AppleScript's text item delimiters to "/"
set tempList to {}
copy every text item of aDate to the end of tempList
set tempList to first item of tempList
set tempMM to item 2 of tempList
set item 2 of tempList to item 1 of tempList
set item 1 of tempList to tempMM
return tempList as string
end formatDate
-- get the selected media items in an array ----------------------
on GetSelection()
set selectedItems to {}
tell application "iView MediaPro"
if window 1 exists then set selectedItems to the selection of window 1
end tell
if number of items in selectedItems is 0 then
display dialog ¬
"You need to select at least one media item in the front catalog in order to use this script." ¬
buttons {"OK"} default button ¬
"OK" with icon note giving up after 10
error number -128
end if
return selectedItems
end GetSelection
-- about this script
on AboutScript()
display dialog ¬
"About "Date from Caption (Nokia 6600)"" & return & return & ¬
"Copies the capture date from the picture's caption " & ¬
"to the Finder's Creation date." & return ¬
buttons {"Cancel", "OK"} default button 2 with icon note
set theAnswer to the button returned of the result
return theAnswer
end AboutScript
I'm not an AppleScript guru, so some code might be written more efficiently, but it works beautifully.
Comments (0)
Mac OS X Hints
http://hints.macworld.com/article.php?story=20040323124742671