Page 1 of 1

Anyone managed to add a session favorite or album?

PostPosted: Tue Jan 29, 2019 9:57 am
by NN636843523123681722UL
Anyone managed to add a session favorite or album?
CODE: SELECT ALL
set newCol to make new collection of document 1 with properties {kind:album, name:"selected"}


just results in missing value error....?

Re: Anyone managed to add a session favorite or album?

PostPosted: Tue Jan 29, 2019 5:35 pm
by Eric Nepean
The working code that I use is this:
Code: Select all
repeat
   tell application "Capture One 12" to tell ref2ResultProject
      if not (exists collection named (get nameResultAlbum & coll_ctr)) then
         set nameResultAlbum to (get nameResultAlbum & coll_ctr)
         set ref2ResultAlbum to make new collection with properties {kind:album, name:nameResultAlbum}
         exit repeat
      else
         set coll_ctr to coll_ctr + 1
      end if
   end tell
end repeat

This based on this post https://forum.phaseone.com/En/viewtopic.php?f=70&t=25568&p=119724&hilit=make+new+collection#p119724

I think what might work for you is this:
Code: Select all
tell application "Capture One 12" to tell document 1 to set ref2NewAlbum to make new collection with properties {kind:album, name:"selected"}

I think its useful and important to take note of Capture One's Applescript dictionary entry for Make
Code: Select all
make v : Create a new object.
   make
      new type : The class of the new object.
      [at location specifier] : The location at which to insert the object.
      [with data any] : The initial contents of the object.
      [with properties record] : The initial values for properties of the object.
      → specifier : The new object.

You can probably include something like this to add the selected variants when you create the collections:
with data (every variant whose selected is true)

For a session, if you use favorite instead of album then you likely have to specify the folder property, since a favorite cannot exist without a folder. This might either come as a property, as in:
Code: Select all
set ref2NewAlbum to make new collection with properties {kind:favorite, name:"selected", folder:someFolderRef}
or perhaps with the the [at location specifier] clause as in
Code: Select all
set ref2NewAlbum to make new collection with properties at someFolderRef with properties {kind:favorite, name:"selected"}

I have not tried using the [at location specifier] clause. Mostly I use catalogs, perhaps if the location is not specified, a default location is used.

As always, proceed one step at a time. Get something that works, the minimum function. Then add stuff one step at a time.