Issues with suspendHistory and makeWorkPath

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

myranalis

Issues with suspendHistory and makeWorkPath

Post by myranalis »

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();
   
}

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

xbytor

Issues with suspendHistory and makeWorkPath

Post by xbytor »

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();
}
myranalis

Issues with suspendHistory and makeWorkPath

Post by myranalis »

Works in CS3 too! Thanks!