I want to save pattern which is used in the layer to separate file. I found in stdlib.jsx function
Code: Select allStdlib.savePatterns = function(file, indexArray) {
var desc = new ActionDescriptor();
desc.putPath(cTID("null"), file);
var list = new ActionList();
for (var i = 0; i < indexArray.length; i++) {
var ref = new ActionReference();
ref.putIndex(cTID("Ptrn"), indexArray);
list.putReference(ref);
}
desc.putList(cTID("T "), list);
executeAction(cTID("setd"), desc, DialogModes.NO);
};
which saves pattern by index but in the layer info there are pattern name and pattern id which look like "$$$/Presets/Patterns/Patterns_pat/TieDye=Tie Dye" and "1b29876b-58b7-11d4-b895-a898787104c1".
I've tried to change index to name:
Code: Select allfunction savePattern() {
var desc = new ActionDescriptor();
desc.putPath(charIDToTypeID("null"), new File("C:/zzzz/pat.pat"));
var ref = new ActionReference();
ref.putName(charIDToTypeID("Ptrn"), "$$$/Presets/Patterns/Patterns_pat/TieDye=Tie Dye");
desc.putReference(charIDToTypeID("T "), ref);
executeAction(charIDToTypeID("setd"), desc, DialogModes.NO);
}
But this function gives me error:
"- The object "pattern "Tie Dye" is not currently available."" What does it mean?
How could I save pattern by name into the separete file (it would be better to image file but pat-file is ok too)?
Thanks,
Andrey