Applying style to layer

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

Applying style to layer

Postby NN110943UL » Fri Apr 24, 2020 9:47 pm

Hi I'm new to AppleScripts but I've been able to make all my other Scripts work but not this one. Trying to apply a style I make in capture one 20 to a new layer.
Code: Select all
tell application "Capture One 20"
   repeat with thisVariant in (get selected variants)
      set theNewLayer to make new layer of thisVariant with properties ¬
         {opacity:50}
      tell theNewLayer to apply style "Test"
   end repeat
end tell

this is the error I am getting:
error "Capture One 20 got an error: Can’t make \"Test\" into type layer." number -1700 from "Test" to layer

Thanks
NN110943UL
 
Posts: 4
Joined: Tue Jun 09, 2009 5:36 pm

Re: Applying style to layer

Postby rapdigital » Wed Apr 29, 2020 2:21 pm

The property apply style refers to applying a style on next capture or import options.
It looks like it can take a layer name to apply the style to but I dont have a camera on my to test.

The styles property seems to belong to the Variant class so, atleast viable applescript and to the best of my knowledge, can only be applied to the background layer.
Even if you specifically tell the variant to apply a style to a layer it will just apply it to the background layer. as you can see with the below.

Code: Select all
tell application "Capture One 20"
   repeat with thisVariant in (get variants whose selected is true)
      set theNewLayer to make new layer of thisVariant with properties ¬
         {opacity:50, name:"rick"}
      tell theNewLayer to fill mask
      tell theNewLayer to set styles of item 1 of thisVariant to "ricka"
   end repeat
end tell


I would have thought that something like the below would work but I cant seem to get to run.

Code: Select all
      tell theNewLayer to set styles of layer "rick" of item 1 of thisVariant to "ricka"
or
      set styles of layer "rick" of item 1 of thisVariant to "ricka" --ricka being the style I'm trying to apply
rapdigital
Certified Professional
Certified Professional
 
Posts: 190
Joined: Mon Feb 02, 2009 1:52 pm

Re: Applying style to layer

Postby NN110943UL » Wed Apr 29, 2020 4:35 pm

Thanks I got it to work.
instead of
Code: Select all
tell theNewLayer to apply style "Test"


I got it to work with
Code: Select all
apply style theNewLayer named "Test"
NN110943UL
 
Posts: 4
Joined: Tue Jun 09, 2009 5:36 pm


Return to Scripting



Who is online

Users browsing this forum: No registered users and 1 guest