Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Check if Exif field exists, and add data.

When I take images from my camera, it contains the Author field as Photographed_by_me, However I also use Helicon Focus, after layering the images all Exif info is lost.


Due to the way my workflow operates, I would like to make a script that checks if this Exif field exists using exifTool. If the Author field contains something then move it to Folder B. else add the author as "Photographed_by_me" then move this file to folder B.


In Photoshop it shows as "Author", under the description tag, but in the coding I think its "Creator"


I hope someone can help me with this?


Many Thanks


Matt

iMac, Mac OS X (10.6.8)

Posted on Feb 8, 2013 1:57 AM

Reply
7 replies

Feb 8, 2013 6:01 AM in response to MattJayC

I've started to look at the script, I think I need something like this? But I don't know how I should write the varible in the shell script.


tell application "Finder"

set this_folder to folder "Hal 9000:Users:matthew:Pictures:Helicon" as alias

set theHotFolder to folder "HotFolder" as alias

set itemList to every file in this_folder

end tell


repeat with i from 1 to count of itemList

set newFile to itemi of itemList



set theCreator to do shell script "/usr/bin/exiftool -ownername " & (quoted form of newFile)



--set returned result of the command above to theCreator



--if theCreator is equal to "" (nothing) then


--do shell script "/usr/bin/exiftool -ownername="Photographed_by_me" " & (itemList)"


--then move newFile to theHotFolder


--else move newFile to theHotFolder


end repeat

Feb 8, 2013 7:17 AM in response to MattJayC

I might actually be learning!



tell application "Finder"

set this_folder to (alias ((path to pictures folder as text) & "HELICON"))

set itemList to every file in this_folder

set theHotFolder to the folder "HotFolder"

end tell



repeat with i from 1 to count of itemList

set newFile to item i of itemList as alias

tell application "System Events"

set iFile to properties of newFile

set theFile to (POSIX path of iFile)


end tell


logtheFile

set theCreator to do shell script "/usr/bin/exiftool -ownername " & theFile

if theCreator is equal to "" then


display dialog "Empty"

do shell script "/usr/bin/exiftool -ownername='Photographed_by_me' " & theFile


else


display dialogtheCreator

end if


end repeat

Feb 8, 2013 7:26 AM in response to MattJayC

OK.>>>> Just need to move it the bit I thought this was the easy bit, any ideas please?


tell application "Finder"

set this_folder to (alias ((path to pictures folder as text) & "HELICON"))

set itemList to every file in this_folder

set theHotFolder to folder "Hal 9000:Users:matthew:Desktop:HotFolder"


end tell



repeat with i from 1 to count of itemList

set newFile to item i of itemList as alias

tell application "System Events"

set iFile to properties of newFile

set theFile to (POSIX path of iFile)


end tell


logtheFile

set theCreator to do shell script "/usr/bin/exiftool -ownername " & theFile

if theCreator is equal to "" then

do shell script "/usr/bin/exiftool -overwrite_original -ownername='Photographed_by_me' " & theFile


movenewFiletotheHotFolder

else


movenewFiletotheHotFolder

end if


end repeat

Feb 8, 2013 8:30 AM in response to MattJayC

OK my refined version


tell application "Finder"

set this_folder to (alias ((path to pictures folder as text) & "HELICON"))

set itemList to every file in this_folder

set theHotFolder to folder "Hal 9000:Users:matthew:Desktop:HotFolder"


end tell



repeat with i from 1 to count of itemList

set newFile to item i of itemList as alias

tell application "System Events"

set iFile to properties of newFile

set theFile to (POSIX path of iFile)

end tell


logtheFile

set theCreator to do shell script "/usr/bin/exiftool -ownername " & theFile

if theCreator is equal to "" then

do shell script "/usr/bin/exiftool -overwrite_original -ownername='Photographed_by_Me' " & theFile

tell application "Finder"


delay 5 -- time here is needed to rewrite the file or ot won't move


movenewFiletotheHotFolder

end tell

else

tell application "Finder"


movenewFiletotheHotFolder

end tell

end if


end repeat

Check if Exif field exists, and add data.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.