Maybe this will help clarify.
I was previously using this script, but I no longer need to resize my images since I will be manually croppping a 2000 x 3000 and it's corresponding 300 x 250 image. All I need is once I crop my images, how can I batch rename them swapping the "i_" file prefix with a "t_" file prefix but maintaing the rest of the filename.
so I will batch name several images then crop in Photoshop at 2000 x 3000 with an "i_FullFileName.jpg".. THEN I will crop large thumbnails of those at 300 x 250 (manually) and I will want to swap the "i" with a "t" at the beginning of the filename while keeping the rest of the filename identical.
how can I tweak this script to do a Save For Web and swap any "i" with a "t" at the beginning of the filename?
thanks
app.preferences.rulerUnits = Units.PIXELS;
var srcDoc = app.activeDocument;
var imgNum = srcDoc.name.substring(2, (srcDoc.name.length)-4);
var myJpgQuality = 12
var sizeArray = [
[630, 420, "b_"],
[210, 140, "m_"],
[140, 93, "t_"]
]
for (var i=0; i<sizeArray.length; i++)
{
var shrinkWidth = sizeArray [i][0];
var shrinkHeight = sizeArray [i][1];
var mySaveName = sizeArray [i][2];
var id428 = charIDToTypeID( "Dplc" );
var desc92 = new ActionDescriptor();
var id429 = charIDToTypeID( "null" );
var ref27 = new ActionReference();
var id430 = charIDToTypeID( "Dcmn" );
var id431 = charIDToTypeID( "Ordn" );
var id432 = charIDToTypeID( "Frst" );
ref27.putEnumerated( id430, id431, id432 );
desc92.putReference( id429, ref27 );
var id433 = charIDToTypeID( "Nm " );
desc92.putString( id433, mySaveName );
executeAction( id428, desc92, DialogModes.NO );
activeDocument.resizeImage(shrinkWidth, shrinkHeight, 72, ResampleMethod.BICUBIC);
filePath = srcDoc.path + '/' + mySaveName + imgNum + '.jpg';
var jpgFile = new File(filePath);
jpgSaveOptions = new JPEGSaveOptions();
jpgSaveOptions.formatOptions = FormatOptions.OPTIMIZEDBASELINE;
jpgSaveOptions.embedColorProfile = true;
jpgSaveOptions.matte = MatteType.NONE;
jpgSaveOptions.quality = myJpgQuality;
activeDocument.saveAs(jpgFile, jpgSaveOptions, true, Extension.LOWERCASE);
app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);
} |