Quick Export then Close Doc Script help
Hey guys, fist time posting - i got a script that opens a doc full of artboard it then updates the smart object on the artboards then exports all the artboard to a folder
i then need it to close the doc but everything i try makes the doc close before the export has taken place, i need it to export then close itself, script below, im new at scripting btw - thanks Luke
// Open Document
newFile = new File ("Z:/Luke/Batch Processing/Batch Phones/01 - Cases.psb");
open (newFile);
// Update Document
var idplacedLayerUpdateAllModified = stringIDToTypeID( "placedLayerUpdateAllModified" );
executeAction( idplacedLayerUpdateAllModified, undefined, DialogModes.NO );
// export activeDocument
quick_export_png(activeDocument.path.fsName)
// export activeLayer
quick_export_png(activeDocument.path.fsName, true);
function quick_export_png(path, layer)
{
try
{
if (layer == undefined) layer = false;
var d = new ActionDescriptor();
var r = new ActionReference();
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
d.putReference(stringIDToTypeID("null"), r);
d.putString(stringIDToTypeID("fileType"), "jpg");
d.putInteger(stringIDToTypeID("quality"), 32);
d.putInteger(stringIDToTypeID("metadata"), 0);
d.putString(stringIDToTypeID("destFolder"), "Z:/Luke/Batch Final");
d.putBoolean(stringIDToTypeID("sRGB"), true);
d.putBoolean(stringIDToTypeID("openWindow"), false);
executeAction(stringIDToTypeID(layer?"exportSelectionAsFileTypePressed":"exportDocumentAsFileTypePressed"), d, DialogModes.NO);
}
catch (e) { throw(e); }
}
