Hi, with admission of Jump_over (hope so 😉 ) and jusat to play around, a on idle event (or any other ...) could simulate the functionality of the textvariable. Launched from startUp Scripts-Folder it'll now prompt for set or refresh the textframes ... Delete it from StartUp-Scripts-Folder and restart ID to stopp the script working #targetengine "session" main(); function main() { var checkPageSize = app.idleTasks.add({name:"checkPageSize", sleep:50000}); checkPageSize.addEventListener(IdleEvent.ON_IDLE, onIdleCheckPageSize, false); } function onIdleCheckPageSize(myIdleEvent){ if(app.documents.length == 0){exit();}; if(!confirm('Add Textframes with Pagesize?')){exit();} myDoc = app.activeDocument; myPages = myDoc.pages.everyItem().getElements(); mhV = myDoc.viewPreferences.horizontalMeasurementUnits; mvV = myDoc.viewPreferences.verticalMeasurementUnits; myDoc.viewPreferences.horizontalMeasurementUnits = myDoc.viewPreferences.verticalMeasurementUnits = MeasurementUnits.MILLIMETERS; for (var k = 0; k < myPages.length; k++) { resString = mySize(myPages ); resFrame = myFrame(myPages ); resFrame.contents = resString; } myDoc.viewPreferences.horizontalMeasurementUnits = mhV; myDoc.viewPreferences.verticalMeasurementUnits = mvV; } function mySize (page) { var Pbound = page.bounds; var pH = Pbound[2] - Pbound[0]; var pW= Pbound[3] - Pbound[1]; var res = "H:\t" + (Math.round(pH*100)/100).toString() + " mm\nW:\t" + (Math.round(pW*100)/100).toString() + " mm"; return res; } function myFrame (page) { var myAllPageItems = page.allPageItems; l = myAllPageItems.length; check = true; while(l--) { if(myAllPageItems .extractLabel('tfLabel') === 'pageSize'){ return myAllPageItems ; check = false;} } if(check){ var mF = page.textFrames.add(); var arrSize = [62,30]; mF.resize( CoordinateSpaces.INNER_COORDINATES, AnchorPoint.TOP_LEFT_ANCHOR, ResizeMethods.REPLACING_CURRENT_DIMENSIONS_WITH, arrSize ); mF.texts[0].properties = {pointSize: 10, justification: Justification.LEFT_ALIGN}; mF.texts[0].tabStops.add({alignment: TabStopAlignment.RIGHT_ALIGN, position: 20}); mF.insertLabel('tfLabel', 'pageSize') return mF; } } Hans-Gerd Claßen
... View more