Hi,
I wrote the following script that reads all the files in the foremost Finder window and marks with the red label all image files that don’t have any GPS information in EXIF, and clears the label of the image files that have.
NB : this script needs iMagine Photo from http://www.yvs.eu.com/imagine.html
tell application "Finder"
set theFolder to folder of front window as alias
set theFiles to every file of theFolder
end tell
set cptGPS to 0
set cptNoGPS to 0
repeat with eachFile in theFiles
set theFile to eachFile as alias
tell application "iMagine Photo"
set avecGPS to false
set thisImporter to import graphic theFile
set exifData to the exif data of thisImporter
close thisImporter
repeat with i from 1 to the count of exifData
set thisItem to item i of exifData
set thisItemExifType to the exif type of thisItem
-- display dialog "exiftype:" & thisItemExifType
if thisItemExifType as string is "gps latitude" then
set avecGPS to true
exit repeat
end if
end repeat
end tell
tell application "Finder"
if avecGPS then
set theLabel to 0
set cptGPS to cptGPS + 1
else
set theLabel to 2
set cptNoGPS to cptNoGPS + 1
end if
set the label index of theFile to theLabel
end tell
end repeat
display dialog "Found " & cptGPS & " pictures with GPS and " & cptNoGPS & " without."
This script can certainly be improved, but it works when run from the Script Editor.
But it doesn’t work when run from the AppleScript menu in the menu bar (after I copied the script to the /Library/Scripts or /Users/myname/Library/Scripts folder).
Do you have any idea what the problem is ?
Thanks
Manu
Model: iMac 24" 2.8GHz Max OS X 10.5.4
Browser: Firefox 3.0.1
Operating System: Mac OS X (10.5)