Skip navigation
Currently Being Moderated

With CS4, some things have changed

Oct 18, 2008 6:40 PM

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.
 
Replies
  • Currently Being Moderated
    Oct 18, 2008 8:04 PM   in reply to (Dave_Saunders)
    One thing to watch for, which isn't really a scripting change but may well<br />affect scripts, is the change to the way rulers work when the document<br />origin is set to spine.<br /><br />In CS4, the rulers measure out from the spine, with values to the left<br />negative and values to the right positive. This means, for example, items on<br />page 2 of a typical facing pages document will have bounds such that x2 is<br />less than x1 if the origin is set to spine.<br /><br />It might be prudent to start setting the origin to a known value at the<br />beginning of some scripts, to avoid surprises.<br /><br />Ironically, the values returned in CS4 match the way they were returned when<br />scripting InDesign (but not in the UI) many versions ago.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2008 2:01 AM   in reply to (Dave_Saunders)
    Hi Dave,

    Thankfully, this thread should be much much shorter than the CS3 one.
    There have been very few changes that will effect existing scripts. How
    about starting another thread for new features? There's a number of new
    features I'm quite happy about! (Like UndoMode, isValid, ScriptUI
    enhancements, etc.) I think they're worth discussing.

    --
    Harbs
    http://www.in-tools.com
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 19, 2008 7:32 AM   in reply to (Dave_Saunders)
    At http://www.kahrel.plus.com/indesign/pdf_dictionaries.html is a list with all properties, methods, and enumerations of InDesign's CS4 object model. New items are highlighted, so that it is easy to see what has been added since CS3.

    Peter
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 29, 2008 10:19 AM   in reply to (Dave_Saunders)
    textWrapType(s) is now textWrapMode(s)

    So instead of this:
    >myObj.textWrapPreferences.textWrapType = TextWrapTypes.jumpObjectTextWrap

    You need this:
    >myObj.textWrapPreferences.textWrapMode = TextWrapModes.jumpObjectTextWrap

    Seems a rather awkward thing to change.

    Peter
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 29, 2008 11:44 AM   in reply to (Dave_Saunders)
    Hi Peter,

    I'm pretty certain that that change has to do with a language-specific problem--probably an AppleScript term conflict.

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 29, 2008 12:37 PM   in reply to (Dave_Saunders)
    Ole,

    Well, I ran a CS3 script in CS4 that contained a line with ...textWrapType = TextWrapTypes..., which errored out on that line. Looked up "textWrapType" in the OMV but it wasn't listed there, and found textWrapMode instead. After changing that, the script ran fine in CS4.

    Peter
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 29, 2008 3:10 PM   in reply to (Dave_Saunders)
    >Nobody reads message 1.

    Groan... Sorry about that! I read it at the time and forgot about it, too.

    Peter
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 6, 2009 8:19 AM   in reply to (Dave_Saunders)
    I guess not too many scripts will have problems with this change, but you never know:

    You have a document with 2 facing pages, and they are not allowed to shuffle like this [1-2].

    Now you use in VB the command:

    oDocument.Spreads.Add

    In all previous CS Versions, InDesign created a new Spread consisting of 2 facing pages 3-4. 3 is a left page and 4 a right page. As I wanted

    Now in CS4 you get as well 2 new pages, but they are not facing. Page 3 is a right page and page 4 is a single left page.

    So my solution just adding 2 new spreads, take the pages you want to keep toghether disable shuffling and delete the unused pages.

    Christoph
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2009 2:14 AM   in reply to (Dave_Saunders)
    I don't know if this is applicable here but can anyone throw some light on the MS Word import.

    We have it working fine on Server CS3 just fine but not on Server CS4. It only imports text formatting, not tables, images, etc. And if it comes across, say an image first it fails to import anything else.

    I can't find any documentation/threads on this as yet. So any pointers greatly appreciated.

    ta!
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2009 9:42 AM   in reply to (Dave_Saunders)
    Hi Ian,

    What that probably means is that there are differences in the Word/RTF import preferences between the two installations--have you compared those?

    Thanks,

    Ole
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2009 10:31 AM   in reply to (Dave_Saunders)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2009 10:50 AM   in reply to (Dave_Saunders)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 4, 2009 10:41 PM   in reply to (Dave_Saunders)
    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
     
    |
    Mark as:
  • Currently Being Moderated
    Mar 18, 2009 2:11 AM   in reply to (Dave_Saunders)
    In postscipt file export pdf, it throw a error like "PAGEMARKS DEFINITION FILE ERROR" i need soultion for this.
    regards,
    kan
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 21, 2009 7:50 AM   in reply to (Dave_Saunders)

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2009 6:23 AM   in reply to (Dave_Saunders)

    Hi,

     

    it looks like that with 6.0.2 Adobe changed the textWrapPreferences property textWrapMode back to textWrapType as it was in CS3.

    Or am I totally confused now ?

     

    Stefan

     
    |
    Mark as:
  • Currently Being Moderated
    May 15, 2009 1:31 PM   in reply to srakete

    Hi Stefan,

     

    It didn't change. Is it possible that you're looking at/using the CS3 version of the scripting DOM?

     

    Thanks,

     

    Ole

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2009 2:55 AM   in reply to Olav Martin Kvern

    Hi Olav,
    yes I was confused scripting for two versions.
    With this it works for both versions now:
    var APP_INT_VERSION = parseInt(app.version);
    if (APP_INT_VERSION == 6) {
         myCurrentFrame.textWrapPreferences.textWrapMode = TextWrapModes.BOUNDING_BOX_TEXT_WRAP;
    } else {
         myCurrentFrame.textWrapPreferences.textWrapType = TextWrapTypes.BOUNDING_BOX_TEXT_WRAP;
    }
    Thanks Stefan

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2009 3:39 AM   in reply to (Dave_Saunders)

    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

     
    |
    Mark as:
  • Currently Being Moderated
    May 18, 2009 4:31 AM   in reply to srakete

    Stefen,

     

    Just a heads up...

     

    Since they're probably not changing the TextWrapModes back, you'd be 

    better off with:

     

    if (APP_INT_VERSION >= 6) {...

     

    Harbs

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 23, 2009 12:40 PM   in reply to (Dave_Saunders)

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Dec 30, 2009 11:32 AM   in reply to (Dave_Saunders)

    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

     
    |
    Mark as:
  • Currently Being Moderated
    Jul 18, 2010 8:21 PM   in reply to (Dave_Saunders)

    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 !

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)