Skip to main content
Inspiring
October 19, 2008
Question

With CS4, some things have changed

  • October 19, 2008
  • 25 replies
  • 16887 views
This topic is not about new features but changes, primarily in the object model, that will affect scripts that run perfectly well under CS3.

Bear in mind that as before, you can create a folder for previous version scripts and run from there, in which case the previous object model is employed -- indeed, CS4 allows you to do this for scripts all the way back to CS scripts. The Object Model Viewer in ESTK, once you've initialized it by opening it once and choosing the InDesign CS4 Object Model, allows you to see all four supported object models.
This topic has been closed for replies.

25 replies

July 19, 2010

I received errors(RPC_E_DISCONNECTED) on both Windows Vista and XP when scripting InDesign CS4 for Windows using C#.NET.

But the same program runs fine with InDesing CS3.

Any suggestions welcome !

zncd
Participant
December 30, 2009

Another thing: CS4 has new required variables in the packageForPrint() function so if you have a call to that function you might get an error (I did).

-Nissan

zncd
Participant
December 23, 2009

Just found that layoutAdjustmentPreference object is gone from the InDesign Server CS4 6.0 DOM. Still there in the desktop version so maybe it was re-classified as part of the UI. All my server scripts turn that off and it was throwing the error.

-Nissan

srakete
Inspiring
May 18, 2009

Hi,

there is a difference between CS3 and CS4 if you want to get the contents of the line of an XmlElement:

If you have myXmlElement in a line and you try to get the contents with

myXmlElement.lines[0].contents;

With CS3 you get the content of the whole line whereas with CS4 you get only the contents up to the XmlElement.

Can anyone confirm this ?

Thanks Stefan

Inspiring
April 21, 2009

This script produces different results in CS3 and CS4:

var myDoc = app.documents.add();
var myTF = myDoc.pages[0].textFrames.add({geometricBounds:myDoc.pages[0].bounds});
var myTable = myTF.parentStory.tables.add(LocationOptions.atEnd);
myTable.bodyRowCount = 7;
for (var j = myTable.bodyRowCount - 1; j >= 0; j--) {
    myTable.cells.item("0:" + j).contents = String(j);
}
var myArray = myTable.columns[0].cells.itemByRange(1, myTable.bodyRowCount -1).texts[0].contents;
alert(myArray)

In CS3, you get an alert that reads:

1,2,3,4,5,6

In CS4, you get just:

1

To get the same alert in CS4 you need to use this to construct myArray:

var myArray = myTable.columns[0].cells.itemByRange(1, myTable.bodyRowCount-1).cells.everyItem().contents;

Dave

Inspiring
March 18, 2009
When you say, "it," what exactly are you talking about? And which scripting language did you use?

Dave
Participant
March 18, 2009
In postscipt file export pdf, it throw a error like "PAGEMARKS DEFINITION FILE ERROR" i need soultion for this.
regards,
kan
Participating Frequently
March 5, 2009
It wasn't that after all. But another 'slight' difference causing stuff not to show up. Seems measurements need to be explicit ie: in CS3 24 was 24mm in CS4 24mm is 24mm!

also idUnformattedTable needs a value in VB I presume
UNFORMATTED_TABLE
UNFORMATTED_TABBED_TEXT
are they

I'll run a series of benchmarks at the weekend and post results.

The differences between CS3 and CS4 post idea is an excellent idea by the way DS
Known Participant
March 4, 2009
Hi Ian,

Something like this:

Rem Given an instance of InDesign "myInDesign"...

myInDesign.WordRTFImportPreferences.PreserveGraphics = True
myInDesign.WordRTFImportPreferences.ConvertTablesTo = idUnformattedTable
Rem ...set other import preferences...
Rem Now do your place operation

Thanks,

Ole
Participating Frequently
March 4, 2009
If I import a doc like this how do I set preferences?

myTextFrame.Place "test.doc"

----
WordRTFImportPreference
preserveGraphics
etc

Seems everything was on by default in CS3 but tables and graphics need prefs specifying in CS4 (I can get text formatting)

any pointers greatly appreciated

many thanks

newb