Morning all.
I have some code that runs perfectly (CS3), but when I put a suspend history call in I get an error on the makeWorkPath method. Error message is "The object 'previous history state' is not currently available."
Below is a quick test that reproduces the problem.
Anyone run into this before? Can I get around it and still suspend the history?
Code: Select allapp.activeDocument.suspendHistory('Test', 'main()');
function main() {
app.activeDocument.selection.selectAll();
app.activeDocument.selection.makeWorkPath();
}
Issues with suspendHistory and makeWorkPath
Issues with suspendHistory and makeWorkPath
I get an error message about the document having no selection in CS4. Weird. This code works for me, however.
Code: Select allapp.activeDocument.suspendHistory('Test', 'main()');
function makeWorkPath() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc266 = new ActionDescriptor();
var ref174 = new ActionReference();
ref174.putClass( cTID('Path') );
desc266.putReference( cTID('null'), ref174 );
var ref175 = new ActionReference();
ref175.putProperty( cTID('csel'), cTID('fsel') );
desc266.putReference( cTID('From'), ref175 );
desc266.putUnitDouble( cTID('Tlrn'), cTID('#Pxl'), 1.000000 );
executeAction( cTID('Mk '), desc266, DialogModes.NO );
};
function main() {
app.activeDocument.selection.selectAll();
makeWorkPath();
}
Code: Select allapp.activeDocument.suspendHistory('Test', 'main()');
function makeWorkPath() {
function cTID(s) { return app.charIDToTypeID(s); };
function sTID(s) { return app.stringIDToTypeID(s); };
var desc266 = new ActionDescriptor();
var ref174 = new ActionReference();
ref174.putClass( cTID('Path') );
desc266.putReference( cTID('null'), ref174 );
var ref175 = new ActionReference();
ref175.putProperty( cTID('csel'), cTID('fsel') );
desc266.putReference( cTID('From'), ref175 );
desc266.putUnitDouble( cTID('Tlrn'), cTID('#Pxl'), 1.000000 );
executeAction( cTID('Mk '), desc266, DialogModes.NO );
};
function main() {
app.activeDocument.selection.selectAll();
makeWorkPath();
}