7 Replies Latest reply: Feb 8, 2013 8:30 AM by MattJayC
MattJayC Level 1 Level 1 (0 points)

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)
  • 1. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    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 item i 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


  • 2. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

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


    this at the moment isn't working at the moment.

     

    The HD name is Hal 9000 and doesn't seam to like the "space"

     

    Result:

    error "File not found: Hal

    File not found: 9000:Users:matthew:Pictures:HELICON:1.psd" number 1

  • 3. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    I realise at this stage I need to turn the newFile into a POSIX path so

    Hal 9000:Users:matthew:Pictures:HELICON:1.psd

    looks like this

     

    Hal 9000/Users/matthew/Pictures/HELICON/1.psd

     

    But don't know how.

  • 4. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    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

      log theFile

              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 dialog theCreator

              end if

     

    end repeat



  • 5. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    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

      log theFile

              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

      move newFile to theHotFolder

              else

      move newFile to theHotFolder

              end if

     

    end repeat


  • 6. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    tell application "Finder"

      move newFile to theHotFolder

                        end tell

     

     

    think I have it working now.

     

    Although i welcome improvements!

  • 7. Re: Check if Exif field exists, and add data.
    MattJayC Level 1 Level 1 (0 points)

    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

      log theFile

              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

      move newFile to theHotFolder

                        end tell

              else

                        tell application "Finder"

      move newFile to theHotFolder

                        end tell

              end if

     

    end repeat