Download Making Your First InDesign Plug-in
Transcript
Table of Contents About this Cookbook ................................................................................................................................................................. 5 The Goal of this CookBook....................................................................................................................................................... 6 The Story of Our Plug-in ........................................................................................................................................................................... 6 About DollyWizard...................................................................................................................................................................... 8 Step 1: Using DollyWizard to generate a Dialog-based plug-in project................................................................ 9 Step 1.1: Launch DollyWizard................................................................................................................................................................. 9 Step 1.2: Specify Necessary Information............................................................................................................................................ 9 Step 1.3: Verify Entered Information and Generate Plug-in Project .....................................................................................11 Step 1.4: Change Creator and Type of DollyWizard-generated Text Files,(Macintosh only) .....................................11 Step 1.5: Convert the XML File to a CodeWarrior Project (Macintosh only) ......................................................................11 Step 1.6: Build the Plug-in......................................................................................................................................................................12 Step 1.7: Prepare to Load the Plug-In................................................................................................................................................13 Step 1.8: Start InDesign through Your IDE ......................................................................................................................................13 Step 1.9: Try Debugging.........................................................................................................................................................................14 Examine the Files Included in the Project Generated by DollyWizard.................................................................15 Detailed Descriptions of the Code Generated by DollyWizard...............................................................................................17 Step 2: Add a DropDownListWidget..................................................................................................................................21 Step 2.1: Add a Widget ID for Our DropDownListWidget.........................................................................................................21 Step 2.2: Define String Keys for List Items on Our DropDownListWidget .........................................................................21 Step 2.3: Define Locale-specific Strings for List Items on Our DropDownListWidget ..................................................21 Step 2.4: Add a DropDownListWidget to Our Dialog Resource..............................................................................................22 Step 2.5: Save, Build and Test ...............................................................................................................................................................23 Step 3: Add a TextEditBoxWidget .......................................................................................................................................24 Step 3.1: Add a Widget ID for Our TextEditBoxWidget ..............................................................................................................24 Step 3.2: Add a TextEditBoxWidget Resource to Our Dialog Resource ...............................................................................24 Step 3.3: Save, Build and Test ...............................................................................................................................................................24 Step 4: Add a StaticTextWidget ...........................................................................................................................................26 Step 4.1: Add a Widget ID for Our StaticTextWidget ..................................................................................................................26 Step 4.2: Define a String Key for Our StaticTextWidget .............................................................................................................26 Step 4.3: Define Locale-specific Strings for Out StaticTextWidget........................................................................................26 Step 4.4: Add a StaticTextWidget Resource to Our Dialog Resource ...................................................................................26 Step 4.5: Save, Build and Test ...............................................................................................................................................................27 The Story About Resources ...................................................................................................................................................28 Step 5: Obtain the value from the DropDownListWidget.........................................................................................37 Step 5.1: Get String Value of Selected Item from DropDownListWidget............................................................................37 Step 5.2: Save, Build and Test ...............................................................................................................................................................37 Step 6: Get the text in the TextEditBoxWidget ..............................................................................................................38 Step 6.1: Get String Value of the Text in TextEditBoxWidget ..................................................................................................38 Step 6.2: Form String to Insert into Text Frame ............................................................................................................................38 The Story About Boss Classes ............................................................................................................................................. 39 What are "Boss Classes"? ........................................................................................................................................................................39 The Story About Interfaces ....................................................................................................................................................40 What are "Interfaces"? .............................................................................................................................................................................40 IPMUnknown, the Parent of (almost) All InDesign Interfaces .................................................................................................40 Querying for Interfaces, and Refcounts............................................................................................................................................40 What is InterfacePtr? ................................................................................................................................................................................40 Which Variety of InterfacePtr Constructor Should I Use for What Situation?....................................................................41 Step 7: Insert the string into a text frame ........................................................................................................................44