Capture One - Getting full list of collections.

I’m trying to get a full list of collections in Capture one by traversing the collection hierarchy recursively from the top level. It’s not working the way I’d expect it to, failing in the recursive call to traverse as indicated by comment. Somehow I’m not getting the sub collections of a collection correctly, I think.:-


tell application "Capture One 9"
		
	my traverse(collections of document 1)
		
end tell

to traverse(cols)
	
	repeat with c in cols
		
		log name of c as text
		traverse(collections of c) -- fails: Can't make |collections| of collection 1 of document \"Main\" into type specifier.
		
	end repeat
	
end traverse

Any help appreciated. Thanks.

Just came across your post researching something related.

This might work for you

set theList to {}
tell application "Capture One 9"
	set cols to name of collections of document 1
	repeat with c in cols
		set theList's end to c
	end repeat
end tell

I think kimaldis’s problem was in traversing collections recursively. I don’t know anything about Capture One 9, but presumably collections can contain collections themselves.

Looking at kimaldis’s code, one obvious problem is the lack of a ‘tell’ statement in the handler to indicate what knows what a ‘collection’ is. At a guess, I’d say the code should look something like this:


tell application "Capture One 9"
		
	my traverse(collections of document 1)
		
end tell

to traverse(cols)
	
	tell application "Capture One 9"

		repeat with c in cols
		
			log name of c as text
			my traverse(collections of c)
		
		end repeat

	end tell
	
end traverse