SpaceDog SpaceDog - 5 months ago 30
AppleScript Question

Apply current selection as a layer mask to the current layer

I have saved a selection as a channel called "circle".
I want to apply this selection as a layer mask to all layers

This is the script I have so far

tell application "Adobe Photoshop CC 2015.5"
set theDOC to the current document

tell theDOC
set totalLayers to count each layer
repeat with indice from 1 to totalLayers by 1

tell layer indice

-- load the channel
tell theDOC
load selection of it from channel "circle" of it
end tell

-- I now need a magic command to apply the "circle" selection that is active now, to the current layer as a layer mask, inside this loop

end tell

end repeat

end tell

end tell


After a deep research I conclude that there is no way to do that, thanks to Adobe. The solution I have for this is:

  1. create an action on Photoshop to add the selection as a mask.
  2. call that action inside the loop using

    do action "mask" from "Default Actions"

    • change mask and Default Actions with your action name and set where the action is stored.