HI,
I am stuck with a part of my script.
After the script has done a whol lot of work to multiple files I would like it to run the following script tosave a jpeg of the file in a folder called Print. This folder needs to be created in the current folder that was last used by photoshop. I looked in the discussion boards but could not find what I needed.
I tried the:
// getting the name and location;
var docName = thedoc.name;
if (docName.indexOf(".") != -1) {var basename = docName.match(/(.*)\.[^\.]+$/)[1]}
else {var basename = docName};
// getting the location, if unsaved save to desktop;
try {var docPath = thedoc.path}
catch (e) {var docPath = "~/Desktop"};
// create folder if it does not exist;
var folderString = docPath+"/"+basename;
if (Folder(folderString).exists == false) {new Folder(folderString).create()};
But this only works if the file has already been saved somewhere. This is not the case and I also do nit want to save the PSD first.
So I Tried the folder.current approach but I do not get the results I am looking for. Any help would be appreciated.
var idsave = charIDToTypeID( "save" );
var desc9 = new ActionDescriptor();
var idAs = charIDToTypeID( "As " );
var desc10 = new ActionDescriptor();
var idEQlt = charIDToTypeID( "EQlt" );
desc10.putInteger( idEQlt, 12 );
var idMttC = charIDToTypeID( "MttC" );
var idMttC = charIDToTypeID( "MttC" );
var idNone = charIDToTypeID( "None" );
desc10.putEnumerated( idMttC, idMttC, idNone );
var idJPEG = charIDToTypeID( "JPEG" );
desc9.putObject( idAs, idJPEG, desc10 );
var idIn = charIDToTypeID( "In " );
//========================================================================================
var basePath = Folder.current;
var folderString = new Folder(basePath + "/Print");
if (Folder(folderString).exists == false) {new Folder(folderString).create()};
//========================================================================================
desc9.putPath( idIn, new File( "" ) );
var idDocI = charIDToTypeID( "DocI" );
desc9.putInteger( idDocI, 35 );
var idsaveStage = stringIDToTypeID( "saveStage" );
var idsaveStageType = stringIDToTypeID( "saveStageType" );
var idsaveSucceeded = stringIDToTypeID( "saveSucceeded" );
desc9.putEnumerated( idsaveStage, idsaveStageType, idsaveSucceeded );
executeAction( idsave, desc9, DialogModes.ALL );