Capture One: Applescript to change EXIF data in image

Discussion in 'Mac Programming' started by rollbahn, May 17, 2017.

  1. rollbahn macrumors newbie

    Joined:
    May 17, 2017
    Location:
    Australia
    #1
    I am testing out Capture One to switch over from Lightroom and as I shoot film and scan at home I always like to add in the camera and lens data. LR has plenty of plugins for this task but in Capture One it looks like my only option to change Camera Make/Model and Lens etc in the EXIF is to run exiftools via an Applescript.

    I have tried a few things and had a good look around online but can't see how to achieve what I want:

    1. Highlight one or more images in Grid view in Capture One
    2. Go to the menu and choose the script and have it loop through and update the EXIF data on the selected images only.

    The code below is what I have tried so far from bits and pieces I have found but I get an error "No File Specified"as I can't figure out how to grab the current file/s names/paths and stick them at the end of the exiftools command and change it as it loops through to update each image's EXIF. Perhaps the whole thing is wrong?

    Any help would be great - thanks.

    Code:
    tell application "Capture One 10"
       set selectedVariants to (get selected variants)
       tell document 1 -- as far as I can tell there is only  ever 1 document     
          if selectedVariants is {} then
             display notification "No images selected -  select one or more images"
          else
             repeat with counter from 1 to count of selectedVariants
                do shell script "/usr/local/bin/exiftool -lens='Leica Summicron-M 35mm f/2' "/path/to/file/image.jpg""
             end repeat
          end if
       end tell
    end tell
    
     
  2. superscape macrumors 6502a

    superscape

    Joined:
    Feb 12, 2008
    Location:
    East Riding of Yorkshire, UK
    #2
    Hi,

    I don't know anything about "Capture One", so I can't help you there. However, there's an obvious error in your exiftool line. It should be something like:

    Code:
    do shell script "/usr/local/bin/exiftool -lens='Leica Summicron-M 35mm f/2' " & quoted form of ("
    /path/to/file/image.jpg")
    
    Hope that's of some help, at least.
     
  3. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium
    #3
    You can do something like :

    Code:
    tell application "Capture One"
        set selectedVariants to get selected variants
        repeat with i from 1 to number of items in selectedVariants
            set this_item to item i of selectedVariants
            set theID to id of (parent image of this_item)
            --do shell script "/usr/local/bin/exiftool -lens='Leica Summicron-M 35mm f/2' " & quoted form of theID
            --Remove the log statement when no longer needed. Used just for demo
            log theID
        end repeat
    end tell
    
    The Replies from running the script :

    Code:
    tell application "Capture One"
        get selected variants
            --> {variant 1 of document "Capture One Catalog", variant 2 of document "Capture One Catalog"}
        get id of parent image of variant 1 of document "Capture One Catalog"
            --> "/Users/kryten/Pictures/Capture One Catalog.cocatalog/Originals/2017/05/18/4/06_02.jpg"
        (*/Users/kryten/Pictures/Capture One Catalog.cocatalog/Originals/2017/05/18/4/06_02.jpg*)
        get id of parent image of variant 2 of document "Capture One Catalog"
            --> "/Users/kryten/Pictures/Capture One Catalog.cocatalog/Originals/2017/05/18/4/32.zip-85.jpg"
        (*/Users/kryten/Pictures/Capture One Catalog.cocatalog/Originals/2017/05/18/4/32.zip-85.jpg*)
    end tell
    
    Note: Tested on Yosemite with Capture One Pro 8.3.4
     
  4. rollbahn thread starter macrumors newbie

    Joined:
    May 17, 2017
    Location:
    Australia
    #4
    Thanks but I just left that in by mistake when I took out an actual path yesterday to post this code. The real issues are outside of that line but I appreciate the help.
    --- Post Merged, May 18, 2017 ---
    Awesome thanks that looks like it may do the trick. I'll give it try today - appreciate your help!
     
  5. rollbahn thread starter macrumors newbie

    Joined:
    May 17, 2017
    Location:
    Australia
    #5
    Thanks very much kryten2 - I've run through a few tests and it all works superbly.
     
  6. kryten2 macrumors 6502a

    Joined:
    Mar 17, 2012
    Location:
    Belgium

Share This Page