Skip to main content

Help with color tag and process / export recipe

Comments

9 comments

  • ericnepean

    Remedial Applescript 101

    You have to consider that AppleScript can address any application on your Mac, and it can send commands about many parts of each of those applications. So you have to tell AppleScript what thing (object) you want it to manipulate - this is done with a “tell” statement, like this:

    tell application "Capture One 22" ##AppleScript, I want you to manipulate CaptureOne.

    ##Applescript is now expecting commands which belong to CaptureOne

    set currentVariants to variants whose selected is true

    tell currentVariants to set color tag to 4 -- green ##OK AppleScript about those variants, set the color tag ## don’t need an end tell here because it’s a 1 line tell that includes the command

    process currentVariants recipe "Send to SPS"

    end tell  ##AppleScript, we’re not taking about CaptureOne anymore

    ## AppleScript will now be confused if you send commands to manipulate CaptureOne 

    ———————— 

    A try statement is tricky to use because it hides the error. The error still happens but AppleScript is not going to stop and tell you something happened.

    A try statement is best used to react to an error that might happen. For example:

    try

    set y to 1/x

    on error

    set y to 9e99

    end try 

    This works fine if x is an integer or real number. But if some other part of the script unexpectedly assigned “Dave Kalmbach” to x, y would still be set to 9e99, but some other unusual stuff might happen. Its usually best to include a message the identifies the error.

    0
  • Dave Kalmbach

    I really appreciate your response and explanation. I'm getting the following error now.

     

    The operation couldn’t be completed. /Users/onetreestudio/Library/Scripts/Capture One Scripts/Send to SPS.scpt: execution error: Can’t set «class vctg» of {«class cvar» id "23" of «class COcl» id "capture" of document "Headshot Method.cosessiondb" of application "Capture One 22"} to 4. (-10006)

    0
  • ericnepean

    I think you’re getting CaptureOne to run the script not ScriptEditor or ScriptDebugger -tell me if my guess is right?
    I’ll have debug tomorrow evening, late here and I have to work tomorrow 

    0
  • Dave Kalmbach

    Yeah, similar error in Script Editor and CO. 

    Thanks!

    0
  • ericnepean

    That’s odd - usually you don’t get errors with that vocabulary in ScriptEditor.

    I’m guessing the error occurs from the command to set the colour of the tag.

    might be an idea to select a variant, set the tag to green, then use AppleScript to get the tag, and log that (using ScriptEditor). Typically you can set things to the thing that you get, and its simpler to debug a get.

    But I will use ScriptDebugger which give a lot more insight

    0
  • Dave Kalmbach

    I'm getting it to work using this: 

    tell application "Capture One 22"

    repeat with thisVariant in (get selected variants)

    tell thisVariant to set color tag to

    process thisVariant recipe "Send to SPS"

    end repeat

    end tell

     

    But I'm getting this pesky sticking error that I have seen before on occasion. Not sure what is causing it. 

    0
  • 7Stars

    Hi Dave,

    I have recently encountered this error message using my own script which uses process.

    It comes from the script installed by default by C1 called something like "Stitching on PS", there are topics on this matter on the forum.

    Personally I deleted the plist file and the message did not show up again.

    1
  • Dave Kalmbach

    Thanks @7Stars I reset the plist following https://support.captureone.com/hc/en-us/articles/360003121597-Reset-the-application-s-preference-file-on-macOS and I haven't seen that warning pop up again. 

    0
  • Dave Kalmbach

    If I were to add a line to script to apply a keyword called "kiosk" to the selected variants right before processing, what would it look like? Nothing I try seems to work.

     

    Thanks so much!

     

    tell application "Capture One 22"

    repeat with thisVariant in (get selected variants)

    tell thisVariant to set color tag to

    process thisVariant recipe "Send to SPS"

    end repeat

    end tell

    0

Please sign in to leave a comment.