Skip to main content

⚠️ Please note that this topic or post has been archived. The information contained here may no longer be accurate or up-to-date. ⚠️

Apply Keyword using Apple Script?

Comments

11 comments

  • Eric Valk

    I don’t have time to check deeply right now, but if memory serves correctly the supported commands are (tell variant to) “add keyword”, “delete keyword”, “get keyword” and “set keyword”
    ScriptDebugger and I think also ScriptEditor have a useful “supported commands” function

    0
  • David Kalmbach

    This is what I've found, just having trouble getting something to work to apply a keyword "kiosk" to the variant inside the script.

    0
  • Kassur

    Funny, I'm working on a similar project :-)

    It seems that Keywords are read only from Apple Script :-(

    You have to create a new library first (or add to an existing one) and add the Keywords manually

     

     

     

    0
  • David Kalmbach

    If you figure out a way I'd love to see what it looks like. I'm totally new to Apple Script. Thanks!

    0
  • Eric Valk

    Sorry for the delay, its been a busy week.

    What has worked for me in a script I wrote for CaptureOne 12 is

    Tell application “Capture One 12” to make keyword at thevariant with properties {name:theNewKWname, parent:theparent}

    theNewKWname and theparent are strings.  (theparent is the parent’s name)

    If there is no parent the don’t include  parent:theparent

    theVariant is a reference to the variant as in 

    Tell application “Capture One 12”
         set theVariantList to selected variants
         repeat with thevariant in theVariantList

     

    0
  • Kassur

    Don't work in CO22 (it's now read only)!

    0
  • Eric Valk

    Solved it. New keywords can only be made in a keyword library.

    First you must make a reference to a keyword Library.
    Set theKeyWordLib to first keyword library
    will work.
    In my case “KeywordLib1” is my keyword library of choice,
    Set theKeyWordLib to keyword library “KeywordLib1”

    Then
    Tell theKeyWordLib to make new keyword with properties {name:”test1”}

    Now that we have a new keyword with the desired contents it can be applied to some variants.

    The making part verified on CO22. Haven’t verified the apply part yet

    Then

    2
  • Kassur

    I made a 'dirty' workaround with Exiftools (I need the information anyway):

    ----------------

    --Script for adding FocusDistance from ExifTools to Keywords in Capture One 22

    --© 2022 Alexei Russak 

     

    tell application "Capture One 22"

     

    repeat with theVariant in (variants whose selected is true)

     

    set picloc to the path of parent image of theVariant

    set picname to the name of parent image of theVariant

     

    set ShutterCount to do shell script "/usr/local/bin/exiftool -FocusDistance " & quoted form of picloc

     

    try

    display dialog ShutterCount with title picname buttons {"Ok", "Copy to Keywords", "Cancel"} default button 3

    set the button_pressed to the button returned of the result

    if the button_pressed is "Ok" then

    --just for further purposes

    set dummy to dummy + 1

    else if the button_pressed is "Copy to Keywords" then

    do shell script "/usr/local/bin/exiftool -Keywords+=" & quoted form of ShutterCount & " " & quoted form of picloc

    reload metadata theVariant

    else

    exit repeat

    end if

    on error

    exit repeat

    end try

     

    end repeat

     

    end tell

     

    ------------

     

    Regards

    0
  • Kassur

    :-) ShutterCount is from a very old project - that's how errors continue :-)

     

    0
  • Emory Dunn

    Sorry to dig up an old thread, but I missed this the first time around. You can absolutely apply keywords directly with AppleScript. I have a script that's part of my scripts collection that just that. You can tell the variant to make a keyword, rather than apply one

    tell theVariant to make keyword with properties {name:theCleanKeyword}
    1
  • Ole Vangsgaard

    Emory Dunn would it be possible to create a script that adds keywords from scanning or something the same way your "next capture folder" script

    Could you scan/enter several keywords and have it "entered" at the same time.

     

    0

Post is closed for comments.