Events. Adobe InCopy CS6

Add to My manuals
105 Pages

advertisement

Events. Adobe InCopy CS6 | Manualzz

7

Events

CS6

Chapter Update Status

Unchanged

InCopy scripting can respond to common application and document events, like opening a file, creating a new file, printing, and importing text and graphic files from disk. In InCopy scripting, the event object responds to an event that occurs in the application. Scripts can be attached to events using the eventListener

scripting object. Scripts that use events are the same as other scripts—the only difference is that they run automatically, as the corresponding event occurs, rather than being run by the user (from the Scripts palette).

This chapter shows how to work with InCopy event scripting. The sample scripts in this chapter are presented in order of complexity, starting with very simple scripts and building toward more complex operations.

We assume that you have already read

Chapter 2, “Getting Started”

and know how to create, install, and run a script.

This chapter covers application and document events. For a discussion of events related to menus, see

Chapter 6, “Menus.”

The InCopy event scripting model is similar to the Worldwide Web Consortium (W3C) recommendation for

Document Object Model Events. For more information, see http://www.w3c.org

.

Understanding the event scripting model

The InCopy event scripting model is made up of a series of objects that correspond to the events that occur as you work with the application. The first object is the event

, which corresponds to one of a limited series of actions in the InCopy user interface (or corresponding actions triggered by scripts).

To respond to an event, you register an eventListener

with an object capable of receiving the event.

When the specified event reaches the object, the eventListener executes the script function defined in its handler function (which can be either a script function or a reference to a script file on disk).

The following table shows a list of events to which eventListeners can respond. These events can be triggered by any available means, including menu selections, keyboard shortcuts, or script actions.

75

Events Understanding the event scripting model 76

User-Interface event Event name

Any menu action beforeDisplay beforeDisplay beforeInvoke

Close

Export

Import

New

Open

Print afterInvoke onInvoke beforeClose afterClose beforeExport afterExport beforeImport afterImport beforeNew afterNew beforeOpen afterOpen beforePrint afterPrint

Description

Appears before the menu or submenu is displayed.

Appears before the script menu action is displayed or changed.

Object type

Event

Event

Appears after the menu action is chosen but before the content of the menu action is executed.

Event

Appears after the menu action is executed.

Event

Executes the menu action or script menu action.

Appears after a close document request is made but before the document is closed.

Event

DocumentEvent

Appears after a document is closed.

DocumentEvent

Appears after an export request is made but before the document or page item is exported.

ImportExportEvent

Appears after a document or page item is exported.

ImportExportEvent

Appears before a file is imported but before the incoming file is imported into a document (before place).

Appears after a file is imported but before the file is placed on a page.

ImportExportEvent

ImportExportEvent

DocumentEvent Appears after a new document request but before the document is created.

Appears after a new document is created.

DocumentEvent

Appears after an open document request but before the document is opened.

DocumentEvent

Appears after a document is opened.

DocumentEvent

Appears after a print document request is made but before the document is printed.

DocumentEvent

Appears after a document is printed.

DocumentEvent

advertisement

Related manuals

Download PDF

advertisement

Table of contents