Process Scripting Error (Newbie..)

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

Process Scripting Error (Newbie..)

Postby james471 » Mon Mar 18, 2019 4:19 am

I'm just starting to play with scripting, so forgive my ignorance here. This is the first script I wrote, it works, but an error message pops up regardless.

Code: Select all
tell application "Capture One 12"
   process primary variant
   recipe "JPEG sRGB"
end tell


The error I get is
Capture One 12 got an error: Error -1728 occurred: Can’t get recipe "JPEG sRGB".
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm

Re: Process Scripting Error (Newbie..)

Postby Eric Nepean » Mon Mar 18, 2019 9:29 am

when you see that little almost invisible "¬" symbol at the end of a line, that's the line continution symbol, the next line is part of this line. You create it by clicking "option"-enter.

what written in the dictionary is this:
Code: Select all
   process primary variant¬
        recipe "JPEG sRGB"
## which is the same as
   process primary variant recipe "JPEG sRGB"

whereas your script told Capture One to execute the recipe command, and it responded "Huh???"

(I think I've just told you that you're one character short of a full script :D )
Eric Nepean
 
Posts: 615
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Process Scripting Error (Newbie..)

Postby james471 » Mon Mar 18, 2019 12:01 pm

Thanks Eric!

Question though, I just looked back at the dictionary and I don't see that little symbol. Where are you seeing that?
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm

Re: Process Scripting Error (Newbie..)

Postby Eric Nepean » Mon Mar 18, 2019 12:25 pm

Interesting.
I see it in the dictionary when using Script Debugger
I do not see it in the Dictionary when using Script Editor

As most people use Script Editor, It was not there for you to see.
Eric Nepean
 
Posts: 615
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Process Scripting Error (Newbie..)

Postby james471 » Mon Mar 18, 2019 1:18 pm

I'll have a look at that software, wasn't familiar with it.

Also, when using properties for recipes, are they supposed to override the selected/enabled recipe?

I've been trying to adjust the properties of a recipe, I don't get any errors, but I regardless of the property value, I only get the properties of the recipe settings in capture one.

So the recipe "JPEG sRGB" in capture one is set to output a 100ppi image, so I'm trying to alter that property to output a 300ppi image, but with the code below, I still get a 100ppi image.

Code: Select all
tell application "Capture One 12"
   process primary variant recipe "JPEG sRGB"
   set enable to true
   set outputformat to JPEG_QuickProof
   set pixelsperinch to 300
end tell
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm

Re: Process Scripting Error (Newbie..)

Postby ben_US » Mon Mar 18, 2019 4:54 pm

james471 wrote:I'll have a look at that software, wasn't familiar with it.

Also, when using properties for recipes, are they supposed to override the selected/enabled recipe?

I've been trying to adjust the properties of a recipe, I don't get any errors, but I regardless of the property value, I only get the properties of the recipe settings in capture one.

So the recipe "JPEG sRGB" in capture one is set to output a 100ppi image, so I'm trying to alter that property to output a 300ppi image, but with the code below, I still get a 100ppi image.

Code: Select all
tell application "Capture One 12"
   process primary variant recipe "JPEG sRGB"
   set enable to true
   set outputformat to JPEG_QuickProof
   set pixelsperinch to 300
end tell


You're telling the application, which doesn't understand the enable, output format, or pixelsperinch properties and instead thinks they're variables. Also, your process command is coming before the alterations- it will result in a processed file, then the changes. Reverse it.
ben_US
Crew
Crew
 
Posts: 677
Joined: Mon Feb 01, 2016 9:51 pm
Location: New York, USA

Re: Process Scripting Error (Newbie..)

Postby james471 » Mon Mar 18, 2019 6:01 pm

okay, so help me understand how to do this properly then. After thinking this through a bit more, and seeing how other scripts work with C1, here's what I feel the script needs to do...in this order..so correct me if I'm wrong.

Tell Capture One 12 to:
select a single variant or multiple variants within the current document
set the parameters for processing
output format to jpeg_quickproof
pixels per inch to 300
root folder type to output location

tell capture to process the variant

Is that some what correct?
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm

Re: Process Scripting Error (Newbie..)

Postby Eric Nepean » Tue Mar 19, 2019 2:15 am

james471 wrote:okay, so help me understand how to do this properly then. After thinking this through a bit more, and seeing how other scripts work with C1, here's what I feel the script needs to do...in this order..so correct me if I'm wrong.

Tell Capture One 12 to:
select a single variant or multiple variants within the current document
set the parameters for processing
output format to jpeg_quickproof
pixels per inch to 300
root folder type to output location

tell capture to process the variant

Is that some what correct?

Close but missing a few details (understandable for newbie - I was there once at least)

First, there is little point in asking Capture One to select variants. How do you tell it which variants to select?

The thinking goes the other way - you (as the user) select variants to tell Capture One which variants you want it to process, and then you run your script. Capture One shall know ye by the variants ye select :lol:

The script then uses this command:
Code: Select all
tell application "Capture One 12" to set theVariants to (get selected variants)
Now the variable theVariants contains references to the variants you (the user) have selected and you (the coder) use this in your script.

Next, it always key to understand the object hierarchy (tree)
  • what kind of objects does each object contain
  • What are the properties of each object
(omitting a few items here)
Application "Capture One 12"
.....contains:
  • variants
  • images
  • windows
  • documents
    .....contain
    • variants
    • images
    • recipes
    • collections
      .....contain
      • variants
      • images
      • collections
        .....contain
        • .....
The following items are a property of a recipe (along with many other properties):
    output format
    pixels per inch
    root folder type
Here's a demo script that shows how to access stuff (Instead of get you can also use set)
Code: Select all
tell application "Capture One 12"
   log {"All the document names:", (get every document's name)}
   log return
   set docRef to current document
   tell current document
      set docName to its name
      set docKind to (get its kind as text)
      set docRef to it -- same as previous line
      set recipeRef to its first recipe
      log "Document is " & docKind & " " & docName
      log return
      
      log "These are " & docName & "'s recipes"
      log (get its recipes)
      log return
      
      log "These are the names of " & docName & "'s recipes"
      log (get name of its recipes)
      log return
      
      log "These are the pixels per inch  of " & docName & "'s recipes"
      log (get pixels per inch of its recipes)
      log return
      
      log "These are the properties of " & docName & "'s first recipe"
      log (get properties of first recipe)
      
   end tell
end tell

tell application "Capture One 12" to tell docRef to get pixels per inch of its first recipe
tell application "Capture One 12" to get recipeRef's pixels per inch
Make sure you open Script Editor's log history window and click on messages (to see the logging) and replies (to see what caopture one is actually sending)
Eric Nepean
 
Posts: 615
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Process Scripting Error (Newbie..)

Postby james471 » Sun Mar 24, 2019 3:37 pm

Thank you Eric, this is some good starting grounds. Now I just need to find the time to learn!!
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm

Re: Process Scripting Error (Newbie..)

Postby Eric Nepean » Sun Mar 24, 2019 7:58 pm

james471 wrote:Thank you Eric, this is some good starting grounds. Now I just need to find the time to learn!!

I have come to understand how diffficult this is for newbies. I got a few minutes and made something that works.

Code: Select all
tell application "Capture One 12"
   set recipeName to "JPEG sRGB"
   set primaryVariantOnly to false
   
   tell current document's recipe recipeName
      set enabled to true
      set output format to JPEG_QuickProof
      set pixels per inch to 300
   end tell
   
   if primaryVariantOnly then
      process primary variant recipe "JPEG sRGB"
   else
      set theVariantList to selected variants
      repeat with theProcessVariant in theVariantList
         process (contents of theProcessVariant) recipe "JPEG sRGB"
      end repeat
   end if
end tell
Eric Nepean
 
Posts: 615
Joined: Sat Oct 25, 2014 8:02 am
Location: Ottawa

Re: Process Scripting Error (Newbie..)

Postby james471 » Mon Mar 25, 2019 4:07 am

Oh this is awesome, going to try it out tomorrow...really appreciate it. It also really helps me understand things by seeing a visual. I'm very good about breaking things down, not so good at starting from scratch.
james471
 
Posts: 26
Joined: Thu Jan 17, 2008 2:31 pm


Return to Scripting



Who is online

Users browsing this forum: No registered users and 1 guest