250 likes | 363 Views
DMED1100 InDesign Advanced. Class 8. Agenda. Scripting Introduction to XML. Scripting is Not …. Overtly challenging Only for programmers Just for long tasks. Running Scripts. Put the script in Adobe InDesign CS4ScriptsScripts Panel
E N D
DMED1100InDesign Advanced Class 8
Agenda • Scripting • Introduction to XML
Scripting is Not … • Overtly challenging • Only for programmers • Just for long tasks
Running Scripts • Put the script in Adobe InDesign CS4\Scripts\Scripts Panel • Could also put a shortcut to the script in the folder • Open Scripts Panel • Window -> Automation -> Scripts • Alt + Ctrl + F11 • Double-click the script name p. 683
Writing Scripts Three main supported scripting languages: • JavaScript • InDesign has built-in support called ExtendScript • Is cross-platform • Doesn’t easily communicate with other (Non-CS) programs • File extension .js or .jsx (preferred) p. 683
Writing Scripts • AppleScript • For the Mac OS • File extension .applescript or .as
Writing Scripts • Visual Basic • For Windows • Three main types: • Visual Basic Script (VBScript) • Visual Basic for Applications (VBA) • Visual Basic (VB 6, VB.NET) • Textbook recommends using VBScript • Can edit via text editor (NotePad or NotePad++) • Could also edit using VBA • Accessible from most Office software
Writing Scripts • In Excel • Developer -> Visual Basic • If Developer tab is unavailable • Office Button -> Excel Options -> Popular -> Show Developer Tab in Ribbon
Writing Scripts • Any language that can connect to the platform works • C, C++, C# • Perl • Python • JScript • And many others …
Scripting Tutorial • Download • InDesignCS4ScriptingTutorial.pdf • InDesignCS4ScriptingTutorialScripts.zip • Work through the tutorial
Using the ESTK • Full-featured text editor • Also checks syntax of script • Edit -> Check Syntax • Make sure InDesign selected as target application • To turn on ID’s screen display • Scripts Panel (ID) -> Options -> Enable Redraw p. 700
Monitoring Events • Scripts can be run when events happen: • Opening a document • Creating a new document • Saving a document • Closing a document • Exporting p. 710
Menu Scripts • Scripts can run menu items or add items to menus • See Adobe InDesign CS4 Scripting Guide for more details p. 712
Startup Scripts • Place script in a folder Startup Scripts in Scripts folder • Need to add some lines to prevent message box p. 712
XML • Extensible Markup Language • A way to tag information in a text file • <author>Information about author</author> • Not just an extension of HTML • HTML is about formatting • XML is about content p. 739
XML Vocabulary • Tag • A label for a piece of XML data • Marked with angle brackets • Cannot contain space characters • Must be well formatted • XML Element • The actual XML data <author>Charles Dickens</author>
XML Vocabulary • Elements may contain other elements: <author> <name>Charles Dickens</name> <dob>7 February 1812</dob> <birthplace>Landport, Portsmouth</birthplace> </author>
XML Vocabulary • XML Attribute • Use to add information about the element • Known as Metadata <author lastUpdate=“10/03/02”> • XML Comment • Allow you to keep notes <!-- This is a comment -->
XML Vocabulary • XML Processing Instructions • InDesign does not use • Can just delete if they exist • DTD (Document Type Definition) • Description of: • What elements appear • The order of appearance • Not required by InDesign
Structure View • View -> Structure -> Show Structure p. 743
XML Tags • Tags panel • Window -> Tags p. 749
Importing XML • File -> Import XML • Import Options: • Mode: Replace or Merge with existing XML • Create Link: to source XML document • Apply XSLT: apply a style sheet • Clone Repeating Text Elements: allows automatic placement of XML elements p. 757
Replacing XML Elements • Select structure in Structure View • Choose Import XML • Turn on Replace Content • Turn on Import Into Selected Element
Exporting XML • File -> Export • Choose XML from Format pop-up menu p. 762
Creating Placeholders • Look at pp. 763-765