DMED1100 InDesign Advanced Class 8
Agenda Scripting Introduction to XML 2
Scripting is Not … Overtly challenging Only for programmers Just for long tasks 3
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 4 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) 5 p. 683
Writing Scripts AppleScript For the Mac OS File extension.applescript or.as 6
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 7
Writing Scripts In Excel Developer -> Visual Basic If Developer tab is unavailable Office Button -> Excel Options -> Popular -> Show Developer Tab in Ribbon 8
Writing Scripts Any language that can connect to the platform works C, C++, C# Perl Python JScript And many others … 9
Scripting Tutorial Download InDesignCS4ScriptingTutorial.pdf InDesignCS4ScriptingTutorialScripts.zip Work through the tutorial 10
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 11 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 12 p. 710
Menu Scripts Scripts can run menu items or add items to menus See Adobe InDesign CS4 Scripting Guide for more details 13 p. 712
Startup Scripts Place script in a folder Startup Scripts in Scripts folder Need to add some lines to prevent message box 14 p. 712
XML Extensible Markup Language A way to tag information in a text file Information about author Not just an extension of HTML HTML is about formatting XML is about content 15 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 Charles Dickens 16
XML Vocabulary Elements may contain other elements: Charles Dickens 7 February 1812 Landport, Portsmouth 17
XML Vocabulary XML Attribute Use to add information about the element Known as Metadata XML Comment Allow you to keep notes 18
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 19
Structure View View -> Structure -> Show Structure 20 p. 743
XML Tags Tags panel Window -> Tags 21 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 22 p. 757
Replacing XML Elements Select structure in Structure View Choose Import XML Turn on Replace Content Turn on Import Into Selected Element 23
Exporting XML File -> Export Choose XML from Format pop-up menu 24 p. 762
Creating Placeholders Look at pp