Next capture settings to apply styles 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.

Next capture settings to apply styles in Applescript

Postby Mahmoud » Wed Sep 27, 2017 5:29 am

Alright folks, so here I'm trying with a simple script, in a tethered session, to ready the next capture settings.
I can't figure out a way to get the (next capture settings apply styles) to work!
How to get ( Styles Library > User Styles > "nameofstyle" )
Image
applied to next capture? has anyone tried this yet?

Here is how my code looks like
Code: Select all
tell application "Capture One 10"
   
   set popup to (display dialog "Scan Tag" default answer "" buttons {"pr1", "pr2", "pr3"} default button 1)
   set scanResult to text returned of popup
   set P to button returned of popup
   
   tell document 1
      set capture name to scanResult
      set capture counter to 0
      if P = "pr2" then
         set apply styles of next capture settings to "nameofstyle2"
      else if P = "pr3" then
         set apply styles of next capture settings to "nameofstyle3"
      end if
      
      display notification scanResult & " is active now! " with title "Scan Complete"
   end tell
end tell


The next capture name works fine, the capture counter as well. Only the part
Code: Select all
set apply styles of next capture settings to "nameofstyle2"

Not approaching it the right way.

Any help is much appreciated.

Thanks
Mahmoud
Mahmoud
Certified Professional
Certified Professional
 
Posts: 7
Joined: Thu Sep 18, 2014 5:09 am
Location: Wisconsin

Re: Next capture settings to apply styles in Applescript

Postby Mahmoud » Wed Sep 27, 2017 7:07 pm

Okay, I found what I was doing wrong here. Solved.

I had to have a "tell" for next capture settings of document 1, then set the settings in text.
like this:

Code: Select all
   tell document 1
      set capture name to scanResult
      set capture counter to 0
   end tell
   if P = "pr2" then
      tell next capture settings of document 1
         set apply styles to {"nameofstyle1"}
      end tell
   else if P = "pr3" then
      tell next capture settings of document 1
         set apply styles to {"nameofstyle2"}
      end tell
      -- display dialog "You Picked pr2 " & scanResult default button 1
   end if


Hope this information is helpful to somebody, as I find this forum a great source of knowledge.

Cheers.
Mahmoud
Certified Professional
Certified Professional
 
Posts: 7
Joined: Thu Sep 18, 2014 5:09 am
Location: Wisconsin


Return to Scripting



Who is online

Users browsing this forum: No registered users and 2 guests