Copy link to clipboard
Copied
Hello,
I am trying to paste my current clipboard contents into a specific alpha channel.
say named "Alpha 6"
The document is likely to have your normal RGB + a number of alpha channels so I need to paste the contents into a specific one.
Doing it by hand works perfectly, no idea how to achieve it via script.
I already have quite a complex java script written that does a lot of things, this is just a extention of it I am trying to do and I just cant figure this bit out. So I do need to use Java for this.
Thanks for any help
For the clipboard to alpha, you can use this function:
function clipboardToAlpha(alphaName) {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putName( s2t( "channel" ), alphaName );
descriptor.putReference( c2t( "null" ), reference );
executeAction( s2t( "select" ), descriptor, D
...
Copy link to clipboard
Copied
Or if there is a way to copy a LayerSet that is not necesarily on top in the document, into a alpha channel without the use of clipboard, that would be even more optimal. Thank you
Copy link to clipboard
Copied
Can you share a screenshot of your layers panel with the targeted layer group/set expanded and visible?
Copy link to clipboard
Copied
For the clipboard to alpha, you can use this function:
function clipboardToAlpha(alphaName) {
var c2t = function (s) {
return app.charIDToTypeID(s);
};
var s2t = function (s) {
return app.stringIDToTypeID(s);
};
var descriptor = new ActionDescriptor();
var descriptor2 = new ActionDescriptor();
var reference = new ActionReference();
reference.putName( s2t( "channel" ), alphaName );
descriptor.putReference( c2t( "null" ), reference );
executeAction( s2t( "select" ), descriptor, DialogModes.NO );
descriptor2.putEnumerated( c2t( "AntA" ), s2t( "antiAliasType" ), s2t( "antiAliasNone" ));
descriptor2.putClass( s2t( "as" ), s2t( "pixel" ));
executeAction( s2t( "paste" ), descriptor2, DialogModes.NO );
}
Then call the function with the required alpha channel name as a parameter in double quotes:
clipboardToAlpha("Alpha 6"); // Alpha channel name
Copy link to clipboard
Copied
This worked perfectly, thank you!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now