Adobe 0046100128056 Scripting Guide - Page 186
Getting started with XML rules
UPC - 718659087562
View all Adobe 0046100128056 manuals
Add to My Manuals
Save this manual to your list of manuals |
Page 186 highlights
CHAPTER 13: XML Rules XML Rules Examples 186 //XMLRuleExampleSetup.jsx // main(); function main(){ var myDocument = app.documents.add(); myDocument.xmlImportPreferences.allowTransform = false; myDocument.xmlImportPreferences.ignoreWhitespace = true; var myScriptPath = myGetScriptPath(); var myFilePath = myScriptPath.path + "/XMLRulesExampleData.xml" myDocument.importXML(File(myFilePath)); var myBounds = myGetBounds(myDocument, myDocument.pages.item(0)); myDocument.xmlElements.item(0).placeIntoFrame(myDocument.pages.item(0), myBounds); function myGetBounds(myDocument, myPage){ var myWidth = myDocument.documentPreferences.pageWidth; var myHeight = myDocument.documentPreferences.pageHeight; var myX1 = myPage.marginPreferences.left; var myY1 = myPage.marginPreferences.top; var myX2 = myWidth - myPage.marginPreferences.right; var myY2 = myHeight - myPage.marginPreferences.bottom; return [myY1, myX1, myY2, myX2]; } function myGetScriptPath() { try { return app.activeScript; } catch(myError){ return File(myError.fileName); } } } Getting started with XML rules Here is a very simple XML rule-it does nothing more than add a return character after every XML element in the document. The XML-rule set contains one rule. For the complete script, see AddReturns.