Saying that... how do I do that manually? If you have a non-background layer as active then you can select the path and go menubar/layer/vector mask/current path… done… You can do the same with script like so… #target photoshop
var doc = app.activeDocument;
doc.pathItems.getByName('Work Path').select();
pathtoVectorMask();
doc.pathItems.getByName('Work Path').remove();
function pathtoVectorMask() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc27 = new ActionDescriptor();
var ref11 = new ActionReference();
ref11.putClass( cTID('Path') );
desc27.putReference( cTID('null'), ref11 );
var ref12 = new ActionReference();
ref12.putEnumerated( cTID('Path'), cTID('Path'), sTID('vectorMask') );
desc27.putReference( cTID('At '), ref12 );
var ref13 = new ActionReference();
ref13.putEnumerated( cTID('Path'), cTID('Ordn'), cTID('Trgt') );
desc27.putReference( cTID('Usng'), ref13 );
executeAction( cTID('Mk '), desc27, DialogModes.NO );
}; The above assumes… 1. you have a document open… 2. your active layer is NOT background 3. you have a path called 'Work Path'… there may be some other checks that you should make too…
... View more