Question

Anyone know if it is possible to load a selection of a layer. For Example I have two shapes on a transparent layer. I want to make a selection on those two shapes. Normally I can just hold command and click the layers thumbnail and have the selection. There is another long path through the selection drop down.

I have tried things like (just guessing at this point)

tell application id "com.adobe.photoshop"
    activate
        load selection of current layer of current document
    end tell
end tell

Anyone ever do this with Applescript?

Was it helpful?

Solution

Only way i could find to do this was to revert to javascript via the do javaScript command

Seems the javascript mode in PhotoShop has some lower level hooks that can solve this particular problem.

e.g,

set js_code to "function SelectTransparency(){
    var idChnl = charIDToTypeID('Chnl');
    var actionSelect = new ActionReference();
    actionSelect.putProperty(idChnl, charIDToTypeID('fsel'));
    var actionTransparent = new ActionReference();    
    actionTransparent.putEnumerated(idChnl, idChnl, charIDToTypeID('Trsp'));
   var actionDesc = new ActionDescriptor();
    actionDesc.putReference( charIDToTypeID('null'), actionSelect);
    actionDesc.putReference( charIDToTypeID('T   '), actionTransparent);
    executeAction(charIDToTypeID('setd'), actionDesc, DialogModes.NO);
}

SelectTransparency();
"

tell application id "com.adobe.photoshop"
    activate
    do javascript js_code
end tell
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top