• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

With CS5, some things have changed

LEGEND ,
Apr 12, 2010 Apr 12, 2010

Copy link to clipboard

Copied

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

TOPICS
Scripting

Views

58.2K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 24, 2010 Jun 24, 2010

Copy link to clipboard

Copied

Some (most) of the text properties which used to return Numbers can now return Strings. This can be a problem if you have a script which adjusts these values.

For example: myText.pointSize = myText.pointSize+1.

In CS4, this would take 12 point text and make it 13 points. In CS5, it'll take the same 12 point text and make it 121 points. This is becase it uses the String "+" operator rather than the Number one. This can catch you really off guard the first time it happens...

The fix is to cast the String as a Number like so: myText.pointSize = Number(myText.pointSize)+1.

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 03, 2010 Jul 03, 2010

Copy link to clipboard

Copied

Footnote will allow the xml tags in CS5?

Arivu..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Jul 03, 2010 Jul 03, 2010

Copy link to clipboard

Copied

No. I don't think so.

One of the pain area for XML works in ID.

sudar1983_14 <forums@adobe.com>

07/03/10 02:41 PM

Please respond to

clearspace-721659546-639966-2-2945664@mail.forums.adobe.com

To

Pankaj Chaturvedi <pankaj.c@thomsondigital.com>

cc

Subject

Re: With CS5, some things have changed

Footnote will allow the xml tags in CS5?

Arivu..

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Jul 04, 2010 Jul 04, 2010

Copy link to clipboard

Copied

Tagging of Footnote Text is not supported in InDesign CS5. Please find below the screen shot for the same.

Screen shot 2010-07-05 at 10.12.09 AM.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jul 27, 2010 Jul 27, 2010

Copy link to clipboard

Copied

JPEGExportPreference.resolution became JPEGExportPreference.exportResolution

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 19, 2010 Sep 19, 2010

Copy link to clipboard

Copied

As Jongware points out here, PointType.LINE_TYPE is now PointType.PLAIN.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 03, 2010 Oct 03, 2010

Copy link to clipboard

Copied

As pointed out here, there is no longer a property PasteBoardPreferences.minimumSpaceAboveAndBelow.


Use PasteBoardPreference.pasteboardMargins instead.

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 14, 2010 Oct 14, 2010

Copy link to clipboard

Copied

I am using a javascript to export a pdf with settings. The script works fine in CS3 and CS4, but not CS5. I get an error from the following line of code for PDF preferences. I am exporting the PDF with OPI. What is the new syntax in CS5 for this setting?

contentToEmbed = PDFContentToEmbed.linkAll;

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 14, 2010 Oct 14, 2010

Copy link to clipboard

Copied

Jongware's CS3 Help document lists the proper form for that command as PDFContentToEmbed.LINK_ALL. Have you tried that.

edit:  Looking at the similar Help files for CS5, this property seems to no longer be supported.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2010 Oct 15, 2010

Copy link to clipboard

Copied

That didn't work. There has to be some javascript command to do this. It is still available in the PDF settings.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Oct 15, 2010 Oct 15, 2010

Copy link to clipboard

Copied

What error are you getting? Try using the numeric value instead of the constant...

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2010 Oct 15, 2010

Copy link to clipboard

Copied

The error is PDFContentToEmbed is undefined. I don't know of any numeric value. This command tells InDesign to create OPI in the PDF for linked images.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 15, 2010 Oct 15, 2010

Copy link to clipboard

Copied

I figured it out. I found the answer in Jongwares ID CS5 scripting help files. That command has been substituted with the omitBitmap, OmitEPS to look more like the PDF Export setting.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 15, 2010 Oct 15, 2010

Copy link to clipboard

Copied

The property itself is removed. I scanned the export settings by eye, then used a full text search, but couldn't locate something similar-with-a-slightly-different-name.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2010 Oct 28, 2010

Copy link to clipboard

Copied

Hi everybody,

I'm a vb script developer and I use to access TextFrames with labels, for instance :

set oFrame = myPage.TextFrames.item("bText")

it seems this method no longer exist in CS5... is it a bug ?

Thanks in advance for your answers,

Philippe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2010 Oct 28, 2010

Copy link to clipboard

Copied

This is dealt with earlier in this same thread.

Peter

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Oct 28, 2010 Oct 28, 2010

Copy link to clipboard

Copied

Thanks Peter,

so here is the "traduction" of the code in VB to access a TextFrame with the label :

Public Sub GetItemFromCollection(ByVal label As String, ByRef collection As InDesign.TextFrames, ByRef oTextFrame As InDesign.TextFrame)
     scriptVersion = oInd.ScriptPreferences.Version
     If scriptVersion > 6 Then oInd.ScriptPreferences.Version = 6
     Set oTextFrame = collection.Item(label)
     oInd.ScriptPreferences.Version = scriptVersion
End Sub

and to call it :

Call GetItemFromCollection("bTexte", oPage.TextFrames, oTexteFrame)

but it was easier before...

Philippe

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Oct 28, 2010 Oct 28, 2010

Copy link to clipboard

Copied

I cant my progress bar working in CS5, it works if i dont trigger it from the menu.

Does anyone have a working script like this?

Here is the script that i made that adds a menu and when you fire the submenu a progress bar should start working in a window, but nothing is happening except when i add an alert, then it fires.

#targetengine "session" // Create menu item var test_menu = app.menus.item('$ID/Main').submenus.add('Test menu'); // Create sub menu action var test_sub_menu = app.scriptMenuActions.add('Run progressbar'); // Set on invoke action test_sub_menu.eventListeners.add('onInvoke', function() {      // Create a simple window      var win = new Window(           "window { \                progressbar: Progressbar { size: [400, 10] } \           }"      );      // Center and show the window      win.center();      win.show();            // Set max value for the progressbar      win.progressbar.maxvalue = 5;            // Make a simple loop from 0 to 4      for(var i = 0; i < 5; i++) {           // This should happen every second           win.progressbar.value = i;                      // Sleep for a second           $.sleep(1000);      }            // Remove the test menus actions      app.scriptMenuActions.item('Run progressbar').remove();            // Remove the test menu      app.menus.item('$ID/Main').submenus.item('Test menu').remove(); }); // Add the sub menu action test_menu.menuItems.add(test_sub_menu);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 17, 2011 Jan 17, 2011

Copy link to clipboard

Copied

I just found a difference in the results from allPageItems, in CS5, which I have to code some kind of exception / condition for, in my scripts before upgrading them to CS5:

allPageItems now includes "contained" objects (images and other linked objects, that reside inside rectangles and such) in CS5.

As a simple test, placing an EPS on an empty page in a new document, I run the following code in CS4 and CS5 respectively:

CS5:
app.activeDocument.pages[0].allPageItems
Result: [object Rectangle],[object EPS]

CS4:
app.activeDocument.pages[0].allPageItems
Result: [object Rectangle]

As you can see, we get the container rectangle only, in CS4, while CS5 is returning the object contained as well.

In a larger result set I get the following objects included in the allPageItems in CS5 (not present in the same call in CS4):

[object Image]
[object EPS]
[object Polygon]
[object PDF]

-- Andreas

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 17, 2011 Jan 17, 2011

Copy link to clipboard

Copied

Interesting. Thanks!

I wonder if it has something to do with the introduction of spline items...

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 17, 2011 Jan 17, 2011

Copy link to clipboard

Copied

In a larger result set I get the following objects included in the allPageItems in CS5 (not present in the same call in CS4):

[object Image]

[object EPS]

[object Polygon]

[object PDF]

New "feature", ehh ...

But this time - one thing could be good:

...

[container]

[content]

...

I think it could be usefull ... there is no way for [content] to be without preceding [container] ...

robin

www.adobescripts.co.uk

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 29, 2011 Jan 29, 2011

Copy link to clipboard

Copied

I noticed today the the Object Model for CS4 has xmlItems.ItemByName, but the Object Model for CS5 does not. I'm trying to work out how to reference an XML Element by name in CS5. xmlItems.item("myElementName") doesn't work. Any ideas?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jan 29, 2011 Jan 29, 2011

Copy link to clipboard

Copied

Interesting. How did it work in CS4?

XMLElements don't have names or labels...

If you are trying to get an element based on its tag, you can check each element's markupTag.

Harbs

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 30, 2011 Jan 30, 2011

Copy link to clipboard

Copied

Interesting finding. I was sure that Adobe had'nt changed anything regarding to XML in CS5. As far as I can see/test your observation is correct.

I would suggest to use the class XMLElement instead of working with the superclass XMLItem.

Given this structure:

<root>

     <child/>

</root>

I would use in CS3/4/5:

app.activeDocument.xmlElements[0].xmlElements.itemByName("child");

Working, but strange:

app.activeDocument.xmlItems[0].xmlElements.itemByName("child");

regards,

gregor

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Jan 31, 2011 Jan 31, 2011

Copy link to clipboard

Copied

Thanks, Gregor. Your proposed solution works for me in this case. Thanks for the help.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines