Zum Hauptinhalt gehen

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

Adding Smart Album

Kommentare

3 Kommentare

  • Eric Valk
    I tried and got the same error. So I thought - perhaps its not possible to have a Smart Album without defining a rule.

    I created a new Smart Album in the usual way with no rules, then used Applescript to read the rules:

    log class of basicrules
    log (get rules of collection 5)
    The results are:
      (*text*)
      (*<?xml version="1.0" encoding="UTF-8"?><MatchOperator Kind="AND"></MatchOperator>*)


    Aha!! so the rules are a text string, and that is the text string for the default rules that do nothing. The following code segment works:
    set newrules to "<?xml version="1.0" encoding="UTF-8"?><MatchOperator Kind="AND"></MatchOperator>"
    set theNewColl to make new collection with properties {kind:smart album, name:"Test 127", rules:newrules}
    There ya go.
    0
  • Christian Jimenez
    Oh brilliant ! You're a genius Eric !!
    So to get it work I just had to set my rules as a string as you mentioned and, for instance, to set the filter "Color Tag is Red" the following code works :

    set newrules to "<?xml version="1.0" encoding="UTF-8"?><MatchOperator Kind="AND"><MatchOperator Kind="AND"><Condition Enabled="YES"><Key>IB_S_BASIC_URGENCY</Key><Operator>0</Operator><Criterion>1</Criterion></Condition></MatchOperator></MatchOperator>"


    Thank you very much Eric !!!
    0
  • Sean Murphy
    Just a bit of our code as additional examples (includes deleting collections):


    tell application "Capture One 10"
    set theDoc to current document
    tell theDoc
    browse to path sessionNamePathPosix & "/Capture"
    delay 0.25
    tell application "System Events" to key code 97
    --------------------------------------------
    --Make Initial Selects Smart Album (images that have star rating of 1 or more)
    --------------------------------------------
    set myRulesInitial to "<?xml version="1.0" encoding="UTF-8"?><MatchOperator Kind="AND"><MatchOperator Kind="AND"><Condition Enabled="YES"><Key>IB_I_BASIC_RATING</Key><Operator>2</Operator><Criterion>1</Criterion></Condition></MatchOperator></MatchOperator>"

    make new collection with properties {kind:smart album, name:"Initial Selects", rules:myRulesInitial}

    --------------------------------------------
    --Make Final Selects Smart Album (images that have green label and rating of 1 or more)
    --------------------------------------------
    set myRulesFinal to "<?xml version="1.0" encoding="UTF-8"?><MatchOperator Kind="AND"><MatchOperator Kind="OR"><Condition Enabled="YES"><Key>IB_S_BASIC_URGENCY</Key><Operator>0</Operator><Criterion>4</Criterion></Condition><Condition Enabled="YES"><Key>IB_S_BASIC_URGENCY</Key><Operator>0</Operator><Criterion>5</Criterion></Condition></MatchOperator></MatchOperator>"

    make new collection with properties {kind:smart album, name:"Final Selects", rules:myRulesFinal}

    --------------------------------------------
    --Delete 'Five Stars' and 'All Images' Smart Albums
    --------------------------------------------
    tell theDoc
    if exists collection named "Five Stars" then
    delete collection named "Five Stars"
    end if
    if exists collection named "All Images" then
    delete collection named "All Images"
    end if
    end tell
    end tell
    end tell
    0

Post ist für Kommentare geschlossen.