Script to save a file in a specific folder with a specific name
Hello,
I found a very useful script to save covers as JPEG, with a fixed width, whatever is the original size :
//the export pixel width
var targetWidthPixels = 600;
var doc = app.activeDocument;
with(doc.viewPreferences){
horizontalMeasurementUnits = MeasurementUnits.INCHES;
verticalMeasurementUnits = MeasurementUnits.INCHES;
}
//get the page width in inches
var pw=doc.documentPreferences.pageWidth;
//calulate the resolution needed to export the jpeg as 1500px wide
//if the page is 8.5" x 11", the output pixel dimensions will be 600px x 776px
var resout= targetWidthPixels/pw;
//the active page
var pg=app.activeWindow.activePage.name;
//set the res preference and page range
with(app.jpegExportPreferences){
exportResolution = resout;
pageString = pg;
antiAlias = true;
embedColorProfile = true;
jpegColorSpace = JpegColorSpaceEnum.RGB;
//add other properties as needed
}
//export the JPEG
doc.exportFile(
ExportFormat.jpg,
File(Folder.desktop + "/ExportJPG.jpg"),
false
);My question is : how to put this file in a specific folder (/Users/toto/Desktop/TEST MTP/OUT site) with a specific name wich is the 14 first characters of every Indesign file name (9782340-046337_COUV_2022_02_24.indd becomes 9782340-046337.jpg)
Thanks for your Help
