I have cobbled together the below working code, as a newbie to jsx, i’m sure this code can be better set up, so any advice on that would be appreciated, I cant figure out how to copy the newFilename to the clipboard, so help with that would be apprecaited. as a side note I am looking for a basic introduction to how “functioons work” as I am struggling with this a bit.
cheers
with (myDoc.documentPreferences) {
pageHeight = "460 mm";
pageWidth = "420 mm";
pagesPerDocument = 1;
app.activeDocument.zeroPoint = [0, 0];
app.layoutWindows[0].zoom(ZoomOptions.FIT_PAGE);
var folders = Folder.desktop.getFiles("*PROOF");
for (var i=0; i<folders.length; i++) {
var new_name = folders[i].name.slice(0,7);
folders[i].rename(new_name);
var newFilename = new_name.slice(1,7);
var myDoc = app.activeDocument;
var file = File(Folder.selectDialog ("Choose a Folder").fsName + "/" + newFilename + "-SS-214.indd");
myDoc.save(file);
//myDoc.copy(); //trying to copy file name to clip board doesnt work//
var w = myDoc.documentPreferences.pageWidth;
var h = myDoc.documentPreferences.pageHeight;
myPage = myDoc.pages.item(0);
var myPDFFile = File.openDialog("Choose a PDF File");
app.pdfPlacePreferences.pageNumber = 1
app.pdfPlacePreferences.pdfCrop = PDFCrop.CROP_BLEED;
myPDFPage = myPage.place(File(myPDFFile), [0,15])[0];
app.activeWindow.transformReferencePoint = AnchorPoint.CENTER_ANCHOR;
var rects = myDoc.rectangles
var rect =rects[0] ;
rect.rotationAngle= 180;
// PETER KAHREL - CENTRE
pages = app.activeDocument.pages.everyItem().getElements();
for (i = 0; i < pages.length; i++) {
pageItems = pages[i].pageItems.everyItem().getElements();
app.activeDocument.align (pageItems, AlignOptions.HORIZONTAL_CENTERS, AlignDistributeBounds.PAGE_BOUNDS);
}
}
}