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. ⚠️

Looping through and geting names of entire nested folder/album structure in User Collections via Applescript

Comments

21 comments

  • Reto Musterle

    I've exactly the same usecase i'd like to solve.

    My current approach is to set manually the IPTC-tag "category" to each photo similar to the folder, then exporting photos into osx-folders "by category" and lastly manually copying these into apple-foto's app.

    would really be interested also on how to automate as you!!

     

    0
  • www.shootmachine.co

    It's a bit hard to understand exactly how things are organised because you are mixing folders (a collection type) with albums (another collection type/concept) in your description. These collection types have esoteric behaviour depending - and also, depending on if catalog or if session. 

     

    0
  • Eric Valk

    I am very glad to see this post. I have the same use case, but for me the CaptureOne part is the easy part, I haven't worked out the Apple Photos part yet.

    A few questions regarding your example

    • folder "2023-01 Seoul Trip" which sits inside Holidays -> Overseas -> South Korea -> 2023-01 Seoul Trip.

    In this example "2023-01 Seoul Trip" is an Album, "Holidays", "Overseas", "South Korea" must be Groups, although one Project is permutted. Is one of these  collections a Project? If there isn't a Project in this tree yet, could you make "Holidays" a project?

    One way of visualizing this is that "2023-01 Seoul Trip" is one of the endpoints of the tree. The job is to find the other endpoints of the tree and export selected files in all the other endpoints?

    0
  • Walter Rowe
    Moderator
    Top Commenter

    Today I worked on a "handler" (AppleScript function) that will deep dive into a user collection and return a list of every project or album with its "name", "path", "kind", and list of variants it contains. The idea would be that you could use the path and name to populate a recipe root folder, and the corresponding list of variants to process into that folder. It is recursive os you can select a top level "group" and it will recurse through its hierarchy.

    The function treats albums and projects the same meaning it does not delve into albums inside a project. If it finds a project it returns all the variants that are part of that project. The kind attribute it returns is "album" or "project" so you at least know that tidbit.

    I need to test it some more but I think this might be helpful for your purpose. Not only can you use the "path" info for setting a recipe's root folder, but it also could be used to create album trees in Photos. The path is a colon separated string much like AppleScript file aliases making it easy to tack onto a root folder path in colon separated format.

    Suppose pictures folder is "Macintosh HD:Users:walter:pictures:" and the album path "Holidays:Overseas:South Korea:2023-01 Seoul Trip".

    You can concatenate them together with "&" as "Macintosh HD:Users:walter:Holidays:Overseas:South Korea:2023-01 Seoul Trip" and convert it to a POSIX path.

    What it cannot do is determine the ancestor path of a lower level user collection which may be what you are seeking to derive.

    0
  • Eric Valk

    Walter, I have the other part, which starts at a lower level and finds the top level collection. Will post later.

    0
  • Walter Rowe
    Moderator
    Top Commenter

    ❤️ I would love to see that Eric!

    0
  • rollbahn

    Thanks everyone and apologies for the lack of clarification on certain points.

    I run one catalog only (never use sessions) which contains all my photos (100k or so). Inside User Collections I have three top level groups - Holidays, Occasions and Various. Within those I have groups for each level I need until getting to the Album level.

    Using my previous example my setup is as follows  - User Collections: Holidays (Group) -> Overseas (Group) -> South Korea (Group) -> 2023-01 Seoul Trip (Album).

    So if I am wanting to export all 5-star images from the 2023-01 Seoul Trip album to put into Apple Photos to share then I need to be able to access all levels of hierarchy from Holidays down to 2023-01 Seoul Trip or vice versa. Also importantly be able to access that hierarchy programmatically so I can export the photos to a folder called for example "Apple Photos" and within that folder have a mirrored folder structure on macOS of my groups and album structure in Capture One. The mirrored folder structure works well also for something like Plex as it will read those folders and keep the same structure when you view the photos section in Plex on my Apple TV (or phone/laptop).

    Another use is if I want to add hierarchical keywords to my image I can use the same code to add that from my group/album structure rather than typing it out in to the Keywords section of Capture One. And if it happens to change I can run a quick script to update them to the new folder structure/keywords.

    This is the result from Script Debugger which shows the collections of a collection of etc etc

    get every variant of current collection of document 1 whose selected of it = true

    {variant id "147025" of collection id "7722" of collection id "5489" of collection id "5421" of collection id "5420" of document "25th June 2024 Catalog"}

    Anyway I hope that all makes a little more sense and someone can help.

    0
  • Walter Rowe
    Moderator
    Top Commenter

    With the function I am writing I think this is entirely possible. The collection path I return would provide you the folder AND keyword hierarchy. Since I already return the list of variants for each album I think it would be pretty straight forward to add an option to query each album and only return variants that meet a certain criteria (ie 5-stars).

    0
  • Eric Valk

    The most difficult part of the problem that rollbahn   is having is that CaptureOne provides no function or property to find the parent of a collection, and that the Applescript function that retreives the container of an item is difficult to access and to use.

    There is however a workaround. The information wanted is present in any error message related to a collection. So we intentionally create an error, capture and parse the error text to create the references we need.

    The function below, FindParentColl() implements that strategy. I first developed it for personal use in 2020, or perhaps earlier, and I've upgraded it to make it more user freindly.

    Walter Rowethis is what I referred to in my post

    The Copyright statement basically says anyone is free to use this, just give me credit.

    The Applescript here includes the FindParentColl() handler, it's dependencies (it uses a couple of other handlers for specialized functions) and its part of a test harness that demonstrates it

    You should be able to set the selected collection in Capture One to 2023-01 Seoul Trip and then execute the script below, the result should be a list of references to all the parents of  2023-01 Seoul Trip.

    You can use "set parentRefList to findParentColl(current_Coll_Ref)" as part of your script, as long as you include the other dependent functions included.

    If needed (I don't think you will) you can get the name of the parent collection as (for example)

    Tell Application "CaptureOne" to Set ParentName to name of item 1 of parentRefList

     

    use AppleScript version "2.4" -- Yosemite (10.10) or later
    use scripting additions

    tell application "Capture One" to tell current document to set current_Coll_Ref to current collection
    set debugLogEnable to true
    set logOnClipboard to true

    set ParentRefList to findParentColl(current_Coll_Ref)




    on findParentColl(thisCollRef)
        ## Copyright 2020 Eric Valk, Ottawa, Canada   Creative Commons License CC BY-SA    No Warranty.
        ## General purpose handler to find the parent(s) of a collection
        ## The input is a reference to some collection
        ## The result is a list of references of all the parents of the input collection
        ## The first item on the list is the immediate parent of the "input" collection
        ## The last item of the list is a reference to the document
        ## If the input collection is at the top level, the list will be of length 1, and the first item will be a reference to the document.
        ##  Length 1 needs to be checked for by the user
        ## If the global variable debugLogEnable is TRUE, then the diagnostic log will be saved in the editor log.
        ## This is useful if running from Script Editor or Script Debugger  
        ## If the global variable logOnClipboard is TRUE then the diagnostic log will be copied to the clipboard
        ## This is useful if running the script as an application
        ## July 14 2020
        ## August 17 2024 (documentation, error checking and diagnostics updated)
        
        global debugLogEnable, logOnClipboard
        local debugLogList, _debugLogEnable, _logOnClipboard, debugListEnable
        
        ## Setup Debugging
        ## If the global variables are present and valid copy the global variables to the shadow variables.
        ## Otherwise set  the shadow variables to false
        
        set {_logOnClipboard, _debugLogEnable, debugListEnable} to {false, false, false}
        try
            copy not (not debugLogEnable) to _debugLogEnable
        end try
        
        try
            copy not (not logOnClipboard) to _logOnClipboard
        end try
        
        set debugListEnable to (_logOnClipboard or _debugLogEnable)
        if debugListEnable then set debugLogList to {"[2] Starting Parent Search"}
        ## Level [1] is a critical error, Level [2] is important stuff, Level [3] is less important stuff, and so forth.
        
        local errorText, errorText1, parentStringList, refPtr, docPtr, docName, parentPtr, ParentRefList, startPtr, stopPtr
        
        ## Check the input argument
        tell application "Capture One"
            if (collection ≠ (class of thisCollRef)) then error ("findParentColl's input parameter is not a collection")
        end tell
        
        ## intentionally create an error
        try
            get || of {thisCollRef} -- this weird applescript should always fail and generate an error message
        on error errorText
            if debugListEnable then set end of debugLogList to return & "[5] Full error text \"" & errorText & "\""
        end try
        
        ## HACK!! Now we extract the collection references from the error message text
        ## Extract the string between "{" and "}"
        repeat with startPtr from 1 to count of errorText
            if "{" = text startPtr of errorText then exit repeat
        end repeat
        repeat with stopPtr from -1 to -(count of errorText) by -1
            if "}" = text stopPtr of errorText then exit repeat
        end repeat
        set errorText to removeLeadingTrailingSpaces((text (startPtr + 1) thru (stopPtr - 1) of errorText))
        ## if this script runs as an application, then "collection" is replaced by "«class COcl»", fix that
        if "«class COcl»" = text 1 thru 12 of errorText then set errorText to replaceText(errorText, "«class COcl»", "collection")
        set parentStringList to splitStringToList(errorText, "of") -- make a list of references
        if debugListEnable then set end of debugLogList to return & "[4] Processed error text \"" & errorText & "\""
        
        ## The last reference will be for the Document. Check for missing document. Save the document reference,
        repeat with docPtr from (count of parentStringList) to 0 by -1
            try
                if "document" = first word of item docPtr of parentStringList then exit repeat
            end try
        end repeat
        set {docPtr, ParentRefList} to {(docPtr + 0), {}}
        if 0 = docPtr then error ("findParentColl couldn't find \"document\" in the string \"" & errorText & "\"" & return & debugLogList)
        set docName to removeLeadingTrailingSpaces((get item 2 of splitStringToList((removeLeadingTrailingSpaces((get item docPtr of parentStringList))), "\"")))
        tell application "Capture One" to copy (document docName) to beginning of ParentRefList
        if debugListEnable then set end of debugLogList to return & "[5] Found Document Reference \"" & (get parentStringList's item docPtr) & "\""
        
        ## There must be at least one reference to a collection. Check for that.
        repeat with parentPtr from 1 to docPtr
            if "collection" = (first word of item parentPtr of parentStringList) then exit repeat
        end repeat
        set parentPtr to parentPtr + 1
        if (parentPtr > docPtr) then error ("findParentColl is unable to find the starting collection in the string \"" & errorText & "\"" & return & debugLogList)
        
        ## All Checks passed. Now get and save the collection references, starting with the top level collection.
        repeat with refPtr from docPtr - 1 to parentPtr by -1
            if debugListEnable then set end of debugLogList to return & "[5] Found Collection Reference \"" & (get parentStringList's item refPtr) & "\""
            tell application "Capture One" to tell (first item of ParentRefList) to copy (collection id (get last word of parentStringList's item refPtr)) to beginning of ParentRefList
        end repeat
        
        if _debugLogEnable then log debugLogList
        if _logOnClipboard then set the clipboard to (get the clipboard) & return & debugLogList
        
        return ParentRefList
    end findParentColl

    on splitStringToList(theString, theDelim)
        # Public Domain
        set theList to {}
        copy AppleScript's text item delimiters to astid
        try
            copy theDelim to AppleScript's text item delimiters
            set theList to text items of theString
        end try
        copy astid to AppleScript's text item delimiters
        return theList
    end splitStringToList

    on joinListToString(theList, theDelim)
        # Public Domain
        set theString to ""
        copy AppleScript's text item delimiters to astid
        try
            copy theDelim to AppleScript's text item delimiters
            set theString to theList as string
        end try
        copy astid to AppleScript's text item delimiters
        return theString
    end joinListToString

    on removeLeadingTrailingSpaces(theString)
        # 40% faster than a version which trims the string 1 space at a time
        # handles both string and list input correctly
        # handles just about any input without crashing
        
        local newString, theSubString, thestringLen, hasTriggered, indexLow, indexHigh, errMess1
        
        if (list = (get (class of theString))) then
            set newString to {}
            repeat with theSubString in theString
                set the end of newString to removeLeadingTrailingSpaces(theSubString)
            end repeat
            return newString
            
        else if (text = (get (class of theString))) then
            set {thestringLen, hasTriggered} to {(get count of theString), false}
            repeat with indexLow from 1 to thestringLen
                set hasTriggered to (" " ≠ (get text indexLow of theString as text))
                if hasTriggered then exit repeat
            end repeat
            if not hasTriggered then return ""
            
            repeat with indexHigh from -1 to (-thestringLen) by -1
                if " " ≠ (get text indexHigh of theString as text) then exit repeat
            end repeat
            return (text indexLow thru indexHigh of theString)
            
        else
            try
                return (get theString as text)
            on error errMess1
                try
                    return (get name of theString)
                on error
                    return errMess1
                end try
            end try
        end if
    end removeLeadingTrailingSpaces

    on replaceText(this_text, search_string, replacement_string)
        copy AppleScript's text item delimiters to astid
        try
            copy search_string to AppleScript's text item delimiters
            set the item_list to every text item of this_text
            copy replacement_string to AppleScript's text item delimiters
            copy (get item_list as string) to this_text
        end try
        copy astid to AppleScript's text item delimiters
        return this_text
    end replaceText

     

    0
  • Walter Rowe
    Moderator
    Top Commenter

    I wonder if there are some regex and string features in the Foundations that might help parse the error string without looping in repeat loops.

    https://www.macscripter.net/t/regular-expression-syntax/72177

    0
  • Walter Rowe
    Moderator
    Top Commenter

    Here is another interesting idea .. use JavaScript String matchAll with a regex to parse the error text.

    https://stackoverflow.com/a/54953152

    0
  • Walter Rowe
    Moderator
    Top Commenter

    Eric Valk

    I took a queue from your code on how to force an error to get the collection path in text form, and how to reconstruct a collection path. I then used the JavaScript String match function with a regex to extract the ordered list of collection IDs from the error text instead of parsing it as you did. This code returns the same list of references your code returns.

    on run
    tell application "Capture One" to tell current document to set theCollection to current collection
    getCollectionPath(theCollection)
    end run

    on getCollectionPath(theColl)
    tell application "Capture One"
    set collPath to {current document}
    tell current document
    try
    -- force an error with an invalid query on the collection
    get || of theColl
    on error errText
    -- get a list of collection IDs from the error text
    -- example return from match: { "18", "17", "13", "12" }
    -- collection ID 18 would represent the collection passed in
    set collIDs to my match(errText, "/(\\d+)/g")
    end try
    end tell
    -- if count is 1 the collection passed in is top level
    if (count of collIDs) > 1 then
    repeat with collIndex from (count of collIDs) to 2 by -1
    set collID to item collIndex of collIDs
    tell first item of collPath to set beginning of collPath to collection id collID
    end repeat
    end if
    end tell
    return collPath
    end getCollectionPath

    # Returns a list of strings from _subject that match _regex
    # _regex in the format of /<value>/<flags>
    # https://stackoverflow.com/a/54953152
    on match(_subject, _regex)
    set _js to "(new String(`" & _subject & "`)).match(" & _regex & ")"
    set _result to run script _js in "JavaScript"
    if _result is null or _result is missing value then return {}
    return _result
    end match

    What do you think?

    0
  • Eric Valk

    Walter Rowe   Good Suggestion, I got rid of all the parsing repeat loops although not quite how you suggested.

    Here is the modified version, some testing but not fully tested

    ** Edited to fix an error **

    use AppleScript version "2.4" -- Yosemite (10.10) or later
    use scripting additions

    tell application "Capture One" to tell current document to set current_Coll_Ref to current collection
    set debugLogEnable to true
    set logOnClipboard to true

    set ParentRefList to findParentColl(current_Coll_Ref)

    tell application "Capture One" to set ParentName to name of item 1 of ParentRefList

    on findParentColl(thisCollRef)
        ## Copyright 2020 Eric Valk, Ottawa, Canada   Creative Commons License CC BY-SA    No Warranty.
        ## General purpose handler to find the parent(s) of a collection
        ## The input is a reference to some collection
        ## The result is a list of references of all the parents of the input collection
        ## The first item on the list is the immediate parent of the "input" collection
        ## The last item of the list is a reference to the document
        ## If the input collection is at the top level, the list will be of length 1, and the first item will be a reference to the document.
        ##  Length 1 needs to be checked for by the user
        ## If the global variable debugLogEnable is TRUE, then the diagnostic log will be saved in the editor log.
        ## This is useful if running from Script Editor or Script Debugger  
        ## If the global variable logOnClipboard is TRUE then the diagnostic log will be copied to the clipboard
        ## This is useful if running the script as an application
        ## July 14 2020
        ## August 17 2024 (documentation, error checking and diagnostics updated)
        ## August 18 2024 (updated to remove iterations per suggestions from Walter Rowe)
        
        global debugLogEnable, logOnClipboard
        local debugLogList, _debugLogEnable, _logOnClipboard, debugListEnable
        
        ## Setup Debugging
        ## If the global variables are present and valid copy the global variables to the shadow variables.
        ## Otherwise set  the shadow variables to false
        
        set {_logOnClipboard, _debugLogEnable, debugListEnable} to {false, false, false}
        try
            copy not (not debugLogEnable) to _debugLogEnable
        end try
        
        try
            copy not (not logOnClipboard) to _logOnClipboard
        end try
        
        set debugListEnable to (_logOnClipboard or _debugLogEnable)
        if debugListEnable then
            set debugLogList to {"[2] Starting Parent Search"}
        else
            set debugLogList to {""}
        end if
        ## Level [1] is a critical error, Level [2] is important stuff, Level [3] is less important stuff, and so forth.
        
        local errorText, errorTextList, parentStringList, countParents, refPtr, docName, ParentRefList
        
        ## Check the input argument
        tell application "Capture One"
            if (collection ≠ (class of thisCollRef)) then error ("findParentColl's input parameter is not a collection")
        end tell
        
        ## intentionally create an error
        try
            get || of {thisCollRef} -- this weird applescript should always fail and generate an error message
        on error errorText
            if debugListEnable then set end of debugLogList to return & "[5] Full error text \"" & errorText & "\""
        end try
        
        ## HACK!! Now we extract the collection IDs from the error message text
        
        ## if this script runs as an application, then "collection" is replaced by "«class COcl»", fix that
        if errorText contains "«class COcl»" then set errorText to replaceText(errorText, "«class COcl»", "collection")
        
        set errorTextList to removeLeadingTrailingSpaces(splitStringToList(errorText, "of")) -- make a list of error strings
        
        ## Check that the errortext  was formatted as expected
        tell errorTextList
            if not ((4 < (count of errorTextList)) and ("Can’t get ||" = item 1 of it) and ("{" = text 1 of item 2 of it) and ("}" = text -2 of item -1 of it)) then error "An Unexpected Error has been generated" & return & debugLogList
        end tell
        
      ## **in error** copy errorTextList's items 3 thru -2 to parentStringList -- create the list of references
      copy errorTextList's items 2 thru -2 to parentStringList -- create the list of references
        if debugListEnable then set end of debugLogList to return & "[4] Processed error text \"" & joinListToString(parentStringList, "; ") & "\""
        
        set docName to removeLeadingTrailingSpaces((get item 2 of splitStringToList((removeLeadingTrailingSpaces((get item -1 of parentStringList))), "\"")))
        if not ("document" = first word of item -1 of parentStringList) then error ("findParentColl couldn't find \"document\" in the string \"" & errorText & "\"" & return & debugLogList)
        if debugListEnable then set end of debugLogList to return & "[5] Found Document Reference :" & (get parentStringList's item -1)
        tell application "Capture One" to set ParentRefList to {(document docName)}
        
        if not ("collection" = (first word of item 1 of parentStringList)) then error ("findParentColl is unable to find the starting collection in the string \"" & errorText & "\"" & return & debugLogList)
        
        ## All Checks passed. Now get and save the collection references, starting with the top level collection.
        set countParents to (count of parentStringList)
        repeat with refPtr from countParents - 1 to 2 by -1
            if debugListEnable then set end of debugLogList to return & "[5] Found Collection Reference \"" & (get parentStringList's item refPtr) & "\""
            tell application "Capture One" to tell (first item of ParentRefList) to copy (collection id (get last word of parentStringList's item refPtr)) to beginning of ParentRefList
        end repeat
        
        if _debugLogEnable then log debugLogList
        if _logOnClipboard then set the clipboard to (get the clipboard) & return & debugLogList
        
        return ParentRefList
    end findParentColl

    on splitStringToList(theString, theDelim)
        # Public Domain
        set theList to {}
        copy AppleScript's text item delimiters to astid
        try
            copy theDelim to AppleScript's text item delimiters
            set theList to text items of theString
        end try
        copy astid to AppleScript's text item delimiters
        return theList
    end splitStringToList

    on joinListToString(theList, theDelim)
        # Public Domain
        set theString to ""
        copy AppleScript's text item delimiters to astid
        try
            copy theDelim to AppleScript's text item delimiters
            set theString to theList as string
        end try
        copy astid to AppleScript's text item delimiters
        return theString
    end joinListToString

    on removeLeadingTrailingSpaces(theString)
        # 40% faster than a version which trims the string 1 space at a time
        # handles both string and list input correctly
        # handles just about any input without crashing
        
        local newString, theSubString, thestringLen, hasTriggered, indexLow, indexHigh, errMess1
        
        if (list = (get (class of theString))) then
            set newString to {}
            repeat with theSubString in theString
                set the end of newString to removeLeadingTrailingSpaces(theSubString)
            end repeat
            return newString
            
        else if (text = (get (class of theString))) then
            set {thestringLen, hasTriggered} to {(get count of theString), false}
            repeat with indexLow from 1 to thestringLen
                set hasTriggered to (" " ≠ (get text indexLow of theString as text))
                if hasTriggered then exit repeat
            end repeat
            if not hasTriggered then return ""
            
            repeat with indexHigh from -1 to (-thestringLen) by -1
                if " " ≠ (get text indexHigh of theString as text) then exit repeat
            end repeat
            return (text indexLow thru indexHigh of theString)
            
        else
            try
                return (get theString as text)
            on error errMess1
                try
                    return (get name of theString)
                on error
                    return errMess1
                end try
            end try
        end if
    end removeLeadingTrailingSpaces

    on replaceText(this_text, search_string, replacement_string)
        copy AppleScript's text item delimiters to astid
        try
            copy search_string to AppleScript's text item delimiters
            set the item_list to every text item of this_text
            copy replacement_string to AppleScript's text item delimiters
            copy (get item_list as string) to this_text
        end try
        copy astid to AppleScript's text item delimiters
        return this_text
    end replaceText

     

     

    0
  • Walter Rowe
    Moderator
    Top Commenter

    Nice Eric Valk ... it is always fascinating to see different ways to achieve the same result.

    0
  • rollbahn

    Just returned from a weekend away to find all these updates! Thanks so much for your excellent script Eric Valk and your help Walter Rowe - very much appreciated and I'll get on to testing it out this week. Agreed about seeing different ways of achieving the same result.

    0
  • Eric Valk

    There may be a better way altogether using one of the very efficient sort algorithms I have collected.
    1. Make a sorted list of the file names in the folder for sharing images with Photos. The “shared list”
    2. Make a sorted list of the names of the 5 star images in the selected collection. The “wanted list”
    3. Make a sorted list of the names of the less than 5 star images in the selected collection. The “unwanted list”
    4. Files whose names are on the unwanted list that are in the shared list are to be deleted. (Only one iterative search is needed)
    5. Images whose names on the wanted list that are not in the shared list are to be added. (Only one iterative search is needed)

    With this approach no need to repopulate the shared images folder from other albums.

    0
  • rollbahn

    I tried the second script out but am getting no group/album names back in Script Debugger. I will attach a screenshot of the results I'm getting back in Script Debugger. Let me know if you need anything else to debug.

    0
  • Walter Rowe
    Moderator
    Top Commenter

    You have to tell the collection to do things:

    tell application "Capture One"
    tell collection id your_Collection_ID_variable
    set collectionName to name
    end tell
    end tell
    0
  • rollbahn

    Sorry all this is a little above my pay grade in terms of AppleScript ability 😀 I am ok with simple code but this is on another level but I'm eager to learn.

    So if I want want to throw all of the group/album names in an array so I can do something with them how would I go about that using Eric Valk 's script?

    0
  • Eric Valk

    rollbahn   I got you. I left too much of a knowledge gap at the end.

    Here is what to do.

    The Script returns a list of references to collections. Using a reference you can find out anything you want about an object, like its name, kind etc.

    The last item in the list is a reference to the document (item -1 of ParentRefList)

    The second last item in the list is a reference to the root collection (item -2 of ParentRefList)

    The first item in the list is a reference to the immediate parent collection (item 1 of ParentRefList)

    These are correct as far as I can see.

    You can get the name, kind and ID of the root collection as follows

    set theRootPointer to -1 + (length of ParentRefList)
    tell application "Capture One"
        set {theName, theKind, ThIid} to (get {name, kind, id} of item theRootPointer of ParentRefList)
        set theKind to theKind as text
    end tell

    In second version of the script that I published, I've just editted it to fix a bug

    You can make Capture One change to  the root collection with the following invocation:

    set theRootPointer to -1 + (length of ParentRefList)

    tell application "Capture One" to tell current document to set current collection to (item theRootPointer of ParentRefList)

     

     

    0
  • rollbahn

    Thanks very much Eric Valk that works perfectly even without the bug update although I will make sure to copy over the script again to pick up the changes.

    That should be enough now for me to work on getting the mirrored folder structure when exporting images.

    Thanks again to everyone who offered their help as there is no way I could have ever come up with that solution by myself.

    0

Post is closed for comments.