Skip to main content
Harbs.
Legend
April 12, 2010
Question

With CS5, some things have changed

  • April 12, 2010
  • 22 replies
  • 62285 views

This discussion is for changes to the scripting DOM which can affect legacy scripts.

Please use this discussion for discussing new scripting features in CS5.

Please keep in mind that all changes are specific to version 7 DOM. InDesign supports versioning, so you should be able to use legacy scripts in CS5 without issues. Versioning can be done in two ways:

1) Place the script in a folder named: "Version 6.0 Scripts" (or 5.0, 4.0, 3.0). The folder must be named exactly as specified.

2) Set the script version preferences at the start of your script. (i.e. app.scriptPreferences.version = 6), but it's highly recommended to reset the scripting version at the end of the script, and even to enclose the script in a try/catch/finally block to ensure that the script preferences are reset correctly.

Here's quick links to issues brought up in this thread:

  1. PageItem.parent
  2. PageItem.itemByName()
  3. PageItem.cornerOption and PageItem.cornerRadius
  4. Text values returned as Strings instead of Numbers
  5. PointType.LINE_TYPE was changed to PointType.PLAIN
  6. PasteBoardPreference.minimumSpaceAboveAndBelow was removed.

Harbs

This topic has been closed for replies.

22 replies

Harbs.
Harbs.Author
Legend
April 12, 2010

PageItem.cornerOption and PageItem.cornerRadius is gone.

Instead there's now: bottomLeftCornerOption, bottomRightCornerOption, topLeftCornerOption, and topRightCornerOption. The same for cornerRadius. This is to support the new live corner features.

Harbs

Harbs.
Harbs.Author
Legend
April 12, 2010

Here's the first two (and probably the most significant) of the changes:

1) PageItem.parent: In previous versions, the parent of top-level page items were the Page that the PaeItem resided on. In CS5, this was changed (for increased performance), and the parent is now the PageItem's Spread. Together with this change, a new property "PageItem.parentPage" was added which returns the page that the PageItem is drawn on. parentPage works for nested PageItems as well, so this new property will do away with the need for a lot of the "findPage" functions that we've all been using!

2) PageItems.itemByName(): With the new layers panel comes a name property for PageItems. In previous versions PageItems.itemByName() would return the page item with the specified label in CS5, it will return the page item with the specified name (which can be set in the Layers Panel). There is no longer a quick-and-easy way to get page items by their label using the 7.0 scripting DOM.

Harbs

Green4ever
Inspiring
March 30, 2011

Hi Harbs,

2) PageItems.itemByName(): With the new layers panel comes a name property for PageItems. In previous versions PageItems.itemByName() would return the page item with the specified label in CS5, it will return the page item with the specified name (which can be set in the Layers Panel). There is no longer a quick-and-easy way to get page items by their label using the 7.0 scripting DOM.

I can able to access a pageItem directly by its name instead of their label.

For example by using the following code I can able to access a textFrame directly by its name (which is already set in the layers panel).

var mytextFrame = app.activeDocument.pages.item(0).textFrames.item("FirstTextFrame");

alert(mytextFrame.contents);

---------

Green4ever

John Hawkinson
Inspiring
March 30, 2011

Yes, that is the point. But prior to CS5 you used to be able to use the script label as the parameter, and now you cannot.