by Eric Nepean » Wed Aug 08, 2018 5:29 am
SeanMurp wrote:Thanks for sharing Eric. That gets me thinking a bit on how our team uses their adjustment layers. Have you played with copying masks to different images? Is that easily done? We do that a lot but I haven't put much time into researching its scripting capabilities.
I haven't tried it but I note that when I execute the the Applescript:
get every layer of primary variantI get the responses:
layer "Background" of variant 10 of collection 1 of collection 13 of document "Incoming"layer 2 of variant 10 of collection 1 of collection 13 of document "Incoming"Note that the reference to the layer also includes the variant, collection and document. Therefore this should work:
- Code: Select all
tell application "Capture One 11"
set sourceLayer to layer 2 of Variant 1
set targetLayer to layer 3 of Variant 2
copy mask sourceLayer to layer targetLayer
end tell
On a side note, we don't often need to invert a mask on a different layer but do interact with layers programmatically. Here is a basic one we use for making an adjustment (shadow recovery in this case) to all images...plus I did my own naming of the layers since I wanted them more descriptive and didn't like the layer numbering.
I would do the same.
Note that in the fill mask command, your target is only defined by "theNewLayer" - the layer reference must include all the information about document, collection and variant.
- Code: Select all
tell application "Capture One 11"
repeat with thisVariant in (get selected variants)
set newLayerIndex to 1 + (count of every layer of thisVariant)
set theNewLayer to make new layer of thisVariant with properties {name:"Shadow Recovery " & newLayerIndex}
tell theNewLayer to fill mask
end repeat
end tell
I'bve started structuring my code along these lines - this eliminates an unnecessary variable, and the line continuation character ¬ still breaks the code into readable chunks
- Code: Select all
tell application "Capture One 11"
repeat with thisVariant in (get selected variants)
set theNewLayer to make new layer of thisVariant with properties¬
{name:"Shadow Recovery " & (get 1 + (count of every layer of thisVariant))}
tell theNewLayer to fill mask
end repeat
end tell
Cheers, Eric
[late 2015 iMac, 4GHz i7, 24GB RAM, external SSDs. GX8, E-M1, GX7, GM5, GM1 ....]