Keywords missing in AppleScript

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

Keywords missing in AppleScript

Postby NN635395415190452258UL » Sat Dec 17, 2016 12:44 pm

Hi,

I'm quiet happy that extended Apple Script support got extended in C1 10.

That said, it doesn't seem to allow access to an image (or variants) keywords. That's causing me issues because it's my main use case for Applescript in C1. Especially since workarounds via XMP sidecar files using reload metadata and sync metadata won't work here: The XMP is naturally bound to the actual image (file) instead of variants for an image and those variants keywords often have different keywords.

Is there something I'm missing?

Best
-Torsten
NN635395415190452258UL
 
Posts: 1
Joined: Sat Jun 28, 2014 9:38 am

Re: Keywords missing in AppleScript

Postby SeanMurp » Fri Jan 06, 2017 11:31 pm

Same here. A different team at our company figured out how to enter data into the different metadata fields (even in Capture One 9), but I'm having a hard time getting it to work for my AppleScripts and can't get ahold of the people that created the original scripts. Perhaps you can help interpret it? And was a bit disappointed that I'm not seeing anything in CO10 that calls out the metadata in the AppleScript dictionary.

(Easier to read without the code function of this forum)

---------------go to metadata tool tab---------------
tell application "Capture One 9" to activate
tell application "System Events"
tell process "Capture One"
set frontmost to true
click menu item "Metadata" of menu 1 of menu item "Select Tool Tab" of menu 1 of menu bar item "View" of menu bar 1
end tell
end tell
-------delay--------------
delay 1
-------------insert copied excel data to metadata------------
tell application "Capture One 9" to activate
tell application "System Events"
tell process "Capture One"
set frontmost to true
--------new metadata
set value of text field 2 of row 49 of outline 1 of scroll area 1 of group 3 of window 1 to photographer
set value of text field 2 of row 37 of outline 1 of scroll area 1 of group 3 of window 1 to stylist
set value of text field 2 of row 48 of outline 1 of scroll area 1 of group 3 of window 1 to bayname
set value of text field 2 of row 58 of outline 1 of scroll area 1 of group 3 of window 1 to budgetline
set value of text field 2 of row 66 of outline 1 of scroll area 1 of group 3 of window 1 to artdirector
set value of text field 2 of row 59 of outline 1 of scroll area 1 of group 3 of window 1 to model
set value of text field 2 of row 60 of outline 1 of scroll area 1 of group 3 of window 1 to digitaltech
set value of text field 2 of row 63 of outline 1 of scroll area 1 of group 3 of window 1 to hairmakeup
end tell
end tell



The end of the 'set value' lines are the variables. I figured all I would have to do is change the variables to fit with my scripts but I keep getting this error:
"System Events got an error: Can’t get outline 1 of scroll area 1 of group 3 of window 1 of process \"Capture One 9\". Invalid index." number -1719 from outline 1 of scroll area 1 of group 3 of window 1 of process "Capture One 9"


I figure this is just looking for the specified row to enter the metadata, but they are using CO9 as well so it should work, no? Anyways, sorry if the above has nothing to do with what you're hoping to do with AppleScript.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby SeanMurp » Fri Jan 06, 2017 11:52 pm

Oh, I also found this blog post on Applescripting Keywords in Capture One 10:
http://www.buggeringabout.com/applescri ... pture-one/

I don't really understand how they are isolating the IPTC Scene field specifically. I don't see that in their code. Then again, I'm more of a newb to AppleScript so could be missing something very easy/basic.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby Eric Nepean » Sat Jan 07, 2017 6:09 am

I am able to write to the metadata fields of a varaint in COP 10. (I have only tried one field so far)

In this work, I find that its key to consult the Applescript Dictionary for COP 10. Start Script Editor, on the menu bar at the top File>Open Dictionary then select the COP Dictionary. There are two parts to the COP 10 dictionary, the standard suite and the Capture One Suite. In the Capture One Suite, there is a lot of information on accessing the metadata fields in the variant item. Although it does not say so, the metadata fields in the variant can read or written.

There is no direct access to keywords in COP 10 from Applescript.

Here is some simple code that reads and sets the source metadata field (in the status section) of the selected images

Code: Select all
tell application "Capture One 10"
   set selectedVariants to (get selected variants)
   tell document 1 -- as far as I can tell there is only  ever 1 document      
      if selectedVariants is {} then
         display notification "No images selected -  select one or more images"
      else
         repeat with Counter from 1 to count of selectedVariants
            set thisVariant to item Counter of selectedVariants
            set oldStource to get status source of thisVariant
            set status source of thisVariant to "test"
         end repeat
      end if
   end tell
end tell


Here are some other useful Applescript commands for COP 10

Code: Select all
tell application "Capture One 10"
   set copVersion to (get app version)
   set everyDoc to get every document
   set allVariants to (get all variants)
   set thisVariant to (get primary variant)
   set everyImage to get every image
   set everyImageNameList to get name of every image
   set everyImageIDList to get id of every image
   
   tell document 1 -- as far as I can tell there is only  ever 1 document, and that is the open catalog or session
      set parentImage to (get parent image of thisVariant)
      set Instructions to (get status instructions of thisVariant)
      set JobID to (get status job identifier of thisVariant)
      set everyCollection to get every collection
      set thisDocName to (get name of document doc_Counter) as text -- only index allowed is 1
      set thisDocFolder to (get folder of document thisDocName) as text
      set thisDocKind to (get kind of document thisDocName) as text
      set thisDocPath to (get path of document thisDocName) --subset of thisFolder
   end tell
end tell

( note also my other post with an Applescript http://forum.phaseone.com/En/viewtopic.php?f=68&t=25218 )

I hope that helps
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Keywords missing in AppleScript

Postby SeanMurp » Mon Jan 09, 2017 8:03 pm

Thanks so much Eric! Really helpful and now gives us a reason to upgrade the whole studio to v10.

One side question, looking through the dictionary I found the "next capture adjustments" tag but how is that implemented? I've tried:

Code: Select all
set next capture adjustments to last captured file


but AppleScript errs with "Can’t set last captured file to last captured file." Being a newb I don't know how to interpret and get the correct section of the Next Capture Adjustments. I'm specifically looking for the metadata next capture adjustment but if I can just change all to "Copy from Last" that would be fine.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby Eric Nepean » Tue Jan 10, 2017 2:17 am

NN636136542251646652UL wrote:Thanks so much Eric! Really helpful and now gives us a reason to upgrade the whole studio to v10.

One side question, looking through the dictionary I found the "next capture adjustments" tag but how is that implemented? I've tried:

Code: Select all
set next capture adjustments to last captured file


but AppleScript errs with "Can’t set last captured file to last captured file." Being a newb I don't know how to interpret and get the correct section of the Next Capture Adjustments. I'm specifically looking for the metadata next capture adjustment but if I can just change all to "Copy from Last" that would be fine.


I don't use image capture (my cameras are incompatible) but I see that youare trying an assignment statement "set ... to ..." but the kind of thing that you are setting "capture adjustments" is not the same kind of thing that your are trying to set it to "file" and this one problem.

After a little but of fiddling, I understand i this way: there are 4 choices for the property "Next Capture Adjustments", the property contols how COP chooses Next Capture Adjustments. These choices are represented by the enum (Default/‌Last/‌Primary/‌Using Clipboard) - this enum is not documented - forgotten, I think.

Applescript will permit the following:
get Next Capture Adjustments -- this returns one of four values: (Default/‌Last/‌Primary/‌Using Clipboard)
set Next Capture Adjustments to Default -- (or to Last or to Primary or to Using Clipboard)

How the Primary adjustments or the Default adjustments are set and maniplulated, I don't know. But one you have them, you can choose them.

I rarely upgrade to new SW on the first release. Not Apple, not Microsoft, not Capture One, and not any other vendor. (I just upgraded some laptops from OSX 10.10.5 to 10.11.6 Nice stable releases, both of them :D ).

If your studio business depends on COP, I wouldd stick with what you have working until 10.1 or 10.2 In this release I note that the Applescript/COP will eventually hang the Mac if you get the properties or all the variants or all the images of the application when the application has a very large number of images (like 15000). I will be opening a ticket on this shortly.

There are probably a few more bugs being flushed out at this stage.
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Keywords missing in AppleScript

Postby SeanMurp » Wed Jan 11, 2017 5:45 pm

Thanks again for the help Eric. Again, a mixed bag of results.

First issue, the code "works" for three of the four enums (Default, Primary and Using Clipboard). Unfortunately the one that I need to use (Last) is throwing a syntax error: "Expected class name but found end of line."

Here is what I put in there which is throwing this error:
Code: Select all
tell application "Capture One 10"
      set next capture adjustments to Last
                -- or to Last or to Primary or to Using Clipboard
   end tell
end tell


Second issue, this is only modifying the "All Other" option within Next Capture Adjustments. There are five options to modify in that section. The one I need to work with is Metadata.

Image

So, when I change "Last" in the code above to Default, Primary or Using Clipboard and run it the dropdown next to All Other changes. But there is nothing obvious in the code that is calling that specific option How in the world would I be able to figure out how to choose the Metadata option instead. Grrr, this is what I find frustrating with coding.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby Eric Nepean » Wed Jan 11, 2017 9:00 pm

NN636136542251646652UL wrote:Thanks again for the help Eric. Again, a mixed bag of results.

First issue, the code "works" for three of the four enums (Default, Primary and Using Clipboard). Unfortunately the one that I need to use (Last) is throwing a syntax error: "Expected class name but found end of line."

Here is what I put in there which is throwing this error:
Code: Select all
tell application "Capture One 10"
      set next capture adjustments to Last
                -- or to Last or to Primary or to Using Clipboard
   end tell
end tell


I get the same behavior. (except that this code snippet has an extra "end tell") This is an obvious case for a support request. I would write: 1) Documentation of the enum is missing in the COP Applescript Dictionary (it should be there - for example check the entry under Suit: COP Class:Application , "Shutter Latency" 2) One of the enum values is not supported. Is the name wrong?

NN636136542251646652UL wrote:Second issue, this is only modifying the "All Other" option within Next Capture Adjustments. There are five options to modify in that section. The one I need to work with is Metadata.

Image

So, when I change "Last" in the code above to Default, Primary or Using Clipboard and run it the dropdown next to All Other changes. But there is nothing obvious in the code that is calling that specific option How in the world would I be able to figure out how to choose the Metadata option instead. Grrr, this is what I find frustrating with coding.

I would raise a (separate) support request for enhancing this feature. I think you want a "NextCaptureMetaData" feature.
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Keywords missing in AppleScript

Postby SeanMurp » Wed Jan 11, 2017 11:47 pm

Thanks Eric! Will submit a support ticket.
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby SeanMurp » Mon Jan 23, 2017 11:22 pm

Well, this isn't helpful!

Case closed as we do not support scripting.

Kind Regards

Phase One support
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby Eric Nepean » Tue Jan 24, 2017 4:32 am

NN636136542251646652UL wrote:Well, this isn't helpful!

Case closed as we do not support scripting.

Kind Regards

Phase One support


They don't support scripting! :shock: On the Phase One Web site in the nice advertisement for Capture One Pro 10 on the Phase One Web site it says:

Apple Script Extended (Mac Only)
Meta data fields, variant selection and EIP pack state can now be targeted for automation routines.


It's not like we have asked for a tutorial on scripting - CaptureOne has a partially broken feature and mistaken documentation.

Well not much we can do about it. Except that I will mention it in other fora.
Cheers
Eric
(OSX 10.12, iMac and MacBook Air, Panasonic GX7,GM5,G5, Olympus E-M1)
Eric Nepean
 
Posts: 385
Joined: Sat Jun 28, 2014 8:54 pm
Location: Ontario, Canada

Re: Keywords missing in AppleScript

Postby Jim_DK » Thu Apr 06, 2017 9:34 pm

Ok, our new beta is out. Might be worth checking out for... well. Things. ;)

www.phaseone.com/beta
James
Phase One DK
Jim_DK
Crew
Crew
 
Posts: 636
Joined: Thu Dec 03, 2009 10:00 pm

Re: Keywords missing in AppleScript

Postby SeanMurp » Wed May 31, 2017 4:32 pm

Thanks James. The AppleScript additions in v10.1.1 are very welcomed!
SeanMurp
 
Posts: 71
Joined: Wed Nov 02, 2016 4:30 am

Re: Keywords missing in AppleScript

Postby Corey Riggle » Fri Jun 02, 2017 4:50 am

Can someone post an example setting a keyword in a selected file?

Thanks in advance.
Corey Riggle
NYC
Digital Capture Specialist
Corey Riggle
 
Posts: 74
Joined: Thu Feb 05, 2009 10:51 pm


Return to Scripting



Who is online

Users browsing this forum: No registered users and 1 guest