Copy link to clipboard
Copied
I'm trying to keep this as simple as possible, so far this is how my script works. At the end I want to add a black layer mask to the document?
Whats the simplist way to make this happen?
#target photoshop
var docRef = activeDocument
var newdLayer = docRef.activeLayer.duplicate();
newdLayer;
var doc = app.activeDocument;
doc.activeLayer = doc.artLayers.getByName("Main Image copy");
doc.activeLayer.applyMedianNoise(12);
doc.activeLayer.applyAddNoise(3, NoiseDistribution.UNIFORM, true)
doc.activeLayer.applyDespeckle()
A simple way would be to use action manager code to add a hide all layer mask. The code would not be readable but you could hit the code in a function to make you mainline code readable.
AddHideAllMask();
function AddHideAllMask(); {
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc7 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var idChnl = charIDToTypeID( "Chnl" );
desc7.putClass( idNw, idChnl );
var idAt = c
...Copy link to clipboard
Copied
A simple way would be to use action manager code to add a hide all layer mask. The code would not be readable but you could hit the code in a function to make you mainline code readable.
AddHideAllMask();
function AddHideAllMask(); {
// =======================================================
var idMk = charIDToTypeID( "Mk " );
var desc7 = new ActionDescriptor();
var idNw = charIDToTypeID( "Nw " );
var idChnl = charIDToTypeID( "Chnl" );
desc7.putClass( idNw, idChnl );
var idAt = charIDToTypeID( "At " );
var ref3 = new ActionReference();
var idChnl = charIDToTypeID( "Chnl" );
var idChnl = charIDToTypeID( "Chnl" );
var idMsk = charIDToTypeID( "Msk " );
ref3.putEnumerated( idChnl, idChnl, idMsk );
desc7.putReference( idAt, ref3 );
var idUsng = charIDToTypeID( "Usng" );
var idUsrM = charIDToTypeID( "UsrM" );
var idHdAl = charIDToTypeID( "HdAl" );
desc7.putEnumerated( idUsng, idUsrM, idHdAl );
executeAction( idMk, desc7, DialogModes.NO );
}
Copy link to clipboard
Copied
Many Thanks for that, I had to drop the ; from this line function AddHideAllMask(); { for it to work.
I'm trying to re write some of my applescripts to photoshop scripts, so I am trying to learn by doing these simpler things, that said is it common in the scripts to look as they do above as its something I can even begin to understand?
Copy link to clipboard
Copied
Yes I can not type I forgot to delet the ; when I did the copy paste.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now