Assuming you have already created the two custom text type variables and you have named them PageWidth and PageHeight respectively. Also, assuming your document has a uniform page size, otherwise using text variables for this makes no sence:
var doc=app.activeDocument; var pageW=doc.textVariables.item('PageWidth'); var pageH=doc.textVariables.item('PageHeight'); var gb=doc.pages.geometricBounds; pageW.contents=gb-gb; pageH.contents=gb-gb;
Thank you for your response. I very new to scripting so I hope you'll bare with me.
How do I apply your code to indesign please? At the moment I have a script that returns the computer user name(an online script i found called 'addCustomVariables_103.jsx') that's going to be one of the variables I use in my media box. This lives in the startup scripts folder but i'm guessing I can't just add your code to it as yours will require an open document to return any values. How would I apply your code so it works in inDesign? Ideally i could do with this automatically adding the text variables at startup as I'll be installing this on several machines.
Thanks once again for your assistance.
To use that code in indd
1. Write code in Adobe ExtendScript save it
2. Copy the jsx file
4. Paste the jsx file in that location