Anyone managed to add a session favorite or album?

Discussion regarding all scripting related questions
Please DO NOT post to this thread anything that is not directly related to scripting of Capture One.

Anyone managed to add a session favorite or album?

Postby NN636843523123681722UL » Tue Jan 29, 2019 9:57 am

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....?
NN636843523123681722UL
 
Posts: 1
Joined: Tue Jan 29, 2019 10:51 am

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

Postby Eric Nepean » Tue Jan 29, 2019 5:35 pm

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.
Cheers, Eric
[late 2015 iMac, 4GHz i7, 24GB RAM, external SSDs. GX8, E-M1, GX7, GM5, GM1 ....]
Eric Nepean
 
Posts: 417
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa


Return to Scripting



Who is online

Users browsing this forum: No registered users and 2 guests