Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Vista

Adobe InDesign CS5 : Using Scripts - Exploring VBA

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/20/2012 9:36:12 AM
VBA, and its subset version VBScript, is Microsoft's technology for writing your own programs, both those that run in other programs (scripts) and those that run by themselves (custom applications). InDesign works with both VBA and VBScript. The Visual Basic language that underlies both VBA and VBScript is not meant for everyday computer users; knowledge of programming is very useful in taking advantage of this technology. Although based on the Basic language developed in the 1970s to help new users write their own programs, it has evolved a lot since then and is no longer so simple.

1. Learning the language

Many of the actions specified in VBA have some degree of English, such as:

set myTextFrame = InDesign.Documents.Item(1).Spreads.Item(1).
   TextFrames.Add

or

mySelection.RotationAngle = 30

As you can see, that degree of English is slight. The first code segment, for example, means to add a text frame to the first spread in the first document. The second means to rotate the selected object by 30 degrees.

2. What you need to write and run scripts

To use InDesign scripting in Windows, you need Microsoft Visual Basic or an application that contains VBA; these include Microsoft Office, Microsoft Visio, and AutoCAD. In Microsoft Office, you can run the Microsoft Script Editor by choosing Tools => Macro => Microsoft Script Editor, which lets you create scripts, edit them, test your code, and fix errors. Figure 1 shows the editor with a sample script. (Note that the script editor's dialog box has the self-important name Microsoft Development Environment rather than Microsoft Script Editor.)

Getting More Information on VBA

Before you venture too far into scripting, you should review the VBA-related information provided by Microsoft and with InDesign:

  • Microsoft scripting documentation and tools: Microsoft has a lot of information on VBA, VBScript, and Visual Basic on its Web site. Unfortunately, it's not well organized and thus is hard to find and understand. There's no tutorial that simply explains how a new scripter needs to get started. However, you can search on the Microsoft site for VBA, VBScript, and Visual Basic to get links to documents that may prove useful.

  • InDesign scripting documentation: The InDesign DVD contains a 2,000-plus-page PDF file that explains scripting in InDesign, including VBA programming. This document, although definitely on the technical side, is a valuable resource. It includes an overview of VBA scripting and the object model, as well as a list of InDesign-specific scripting terms and scripting examples.


Figure 1. The Microsoft Development Environment window contains sample VBA text. When you work on a script, the Microsoft Development Environment applies indents automatically.

You can also write scripts in VBScript, a VBA subset, in a text editor such as WordPad. You need Microsoft's free Windows Scripting Host (WSCRIPT.EXE), which is usually installed with Windows, and you can download it from Microsoft's Web site.

There's a third choice for your scriptwriting: You can also use the full Microsoft Visual Basic product.

NOTE

To use InDesign scripting in Windows, your user profile must have Administrator privileges.

To see what Visual Basic commands InDesign supports, you can view the InDesign object model — the supported commands — within the Microsoft's Visual Basic product; just choose Project => References and then select Adobe InDesign CS5 Type Library in the References dialog box and click OK.


2.1. Running your script

There are a few ways to run a VBScript. You can double-click the script in the Scripts panel within InDesign or double-click the script file itself from a folder. When developing scripts, you can run the script directly from the application in which you created a VBA or Visual Basic script, such as the Microsoft Script Editor. (VBScripts can be run from the Scripting Host application.) In all these cases, InDesign becomes the active program, and your script is running.

2.2. Saving your script

When you're finished writing and testing a script, choose Save from the script editor's File menu. Name your script and choose its storage location.

Other -----------------
- Dreamweaver CS5 : Standard Server Behaviors (part 6) - Stored procedure/command/callable
- Dreamweaver CS5 : Standard Server Behaviors (part 5) - Dynamic elements
- Dreamweaver CS5 : Standard Server Behaviors (part 4) - Update Record, Delete Record & User authentication
- Dreamweaver CS5 : Standard Server Behaviors (part 3) - Go To Detail Page, Related Page & Insert Record
- Dreamweaver CS5 : Standard Server Behaviors (part 2) - Recordset Paging, Move To Specific Record & Show Region
- Dreamweaver CS5 : Standard Server Behaviors (part 1) - Recordset & Repeat Region
- CorelDRAW X5 : Text and Styles
- CorelDRAW X5 : Wrapping Text Around Other Shapes
- Adobe Illustrator CS5 : Working with Layers - Flattening Layers & Locating Objects in the Layers Panel
- Adobe Illustrator CS5 : Working with Layers - Moving Objects to a Layer
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server