1 2 Previous Next 69 Replies Latest reply: Jan 25, 2010 12:33 AM by Andreas Jansson RSS

    With CS3, some things have changed

    Community Member
      Let's use this topic to record changes that are likely to affect a working script. As I did in the CS2 comparable topic, I'll add an index here in the topic title when the list is long enough (and I have the time).
        • 1. Re: With CS3, some things have changed
          Community Member
          This affects JavaScript users only.

          Pages.documentOffset now returns the page index within the document, so the first page now has an offset of zero, not one.

          Dave
          • 2. Re: With CS3, some things have changed
            Dave, for the benfeit of those who haven't yet seen documention for CS3's scripting, it is now posted at http://www.adobe.com/devnet/indesign/ included within the 400 megabyte (!) CS3 SDK, the practical reason being that you can now write scripts almost as powerful as plug-ins. My favorite new features so far: Startup Scripts and Custom Labels! Menus and Event Listeners look very promising, too. And XML Rules for the serious crowd...

            [Added by Ole]

            Thanks, Gary. Please note! You can get the scripting documentation and example scripts without having to download the entire SDK from:

            http://www.adobe.com/products/indesign/xml_scripting.html

            Click the (hard to see) Scripting tab to display the scripting info. The page will be updated soon with more information and scripts.
            • 3. Re: With CS3, some things have changed
              Community Member
              In CS2 and before, the collection of text frames (and text paths) which, threaded together, constituted a story could be referenced by:

              Story.textFrames;

              in CS3, this returns the collection of textFrames that are inline/anchored to the story. This change brings this terminology into line with other similar constructions, such as Story.rectangles but it breaks any existing scripts that use this to access the threaded frames.

              In CS3, you should use:

              Story.textContainers;

              This returns and array of the text frames and/or text paths that make up the story. Note that it is not a collection, so you can't use everyItem() on the result and neither can you refer to

              Story.textContainers[-1];

              to get the last frame of the threaded story. Instead, you should use something like:

              myStory.textContainers[myStory.textContainers.length -1];

              or the equivalent in the scripting language of your choice.

              Dave
              • 4. Re: With CS3, some things have changed
                pkahrel MVP
                In CS2, if you select a number of objects in the UI, then app.selection would reflect the order in which the objects had been selected. app.selection[0] would be the last selected object. In CS3 this is no longer the case: the order of the selected objects reflects their order of creation.

                Peter
                • 5. Re: With CS3, some things have changed
                  Community Member
                  someone in Adobe likes to make scripter's life harder ...

                  what else ?? ;)

                  robin

                  --
                  www.adobescripts.com
                  • 6. Re: With CS3, some things have changed
                    Community Member
                    Robin,

                    This topic is locked at the top of the forum and will be there for the next couple of years. Do you really want that comment to be so prominently displayed for all that time?

                    Dave
                    • 7. Re: With CS3, some things have changed
                      Community Member
                      Hi Robin,

                      Well...we're trying to make it easier, actually. But there are some things we just can't avoid when the underlying architecture changes. Transformations, for example, changed a great deal between CS2 and CS3 because they were completely rewritten. This rewrite brings with it a number of advantages, but it also adds a fair amount of complexity.

                      In any case, we've still got script versioning, so that you can continue to use the previous version of the object model if that's what you prefer. I hope that you'll find enough good stuff in the CS3 model to make it worth upgrading--grep, events, menu scripting, XML rules, and performance improvements seem like pretty compelling arguments, to me.:-)

                      Thanks,

                      Ole
                      • 8. Re: With CS3, some things have changed
                        Community Member
                        > Well...we're trying to make it easier, actually.
                        > But there are some things we just can't avoid
                        > when the underlying architecture changes.
                        > Transformations, for example, changed a great
                        > deal between CS2 and CS3 because they were
                        > completely rewritten. This rewrite brings with
                        > it a number of advantages, but it also adds
                        > a fair amount of complexity.

                        I refer to two "news" about what was changed:

                        1) Dave's info about Story.textContainers isn't collection anymore - WHY ?? why now will be better ?? if this was changed - why all other collections weren't "uncollected", too ;)

                        2) Peter's info about ordering of selected objects - somebody in Adobe does this intentionally - so obviously he knew what he was doing - but WHY ?? why index of creation will be better than order of selection ?? why creation index wasn't added as one more property ??

                        maybe all changes - should be discused with scripters and accepted by them ?? ;)

                        I don't want to be rude - I only want to know - if somebody could say - why there are so big - and controversial - changes ...

                        Olav - there is no ScriptingReference on Adobe.com, there is no ScriptingReference in SDK CS3 - where/when it will be available, please ...

                        robin

                        --
                        www.adobescripts.com
                        • 9. Re: With CS3, some things have changed
                          Community Member
                          Hi Robin,

                          re: "1) Dave's info about Story.textContainers isn't collection anymore - WHY ?? why now will be better ?? if this was changed - why all other collections weren't "uncollected", too."

                          No, we'd rather have it be a collection--it's just that there wasn't time to make it a collection. We were trying to respond to criticism that Story.TextFrames ought to return the text frames used as anchored/inline frames in the story (to make it consistent with rectangles, etc.). As I recall, we also had to fix a bug regarding the differences between text frames/text paths in a story.

                          re: "2) Peter's info about ordering of selected objects - somebody in Adobe does this intentionally - so obviously he knew what he was doing - but WHY ?? why index of creation will be better than order of selection ?? why creation index wasn't added as one more property ??"

                          Again, this wasn't an intentional, designed change. The architecture of selection changed, and scripting simply reflects the underlying order. I agree that it's not ideal! That said, I don't know of too many scripts that rely on the order of selection.

                          re: scripting reference

                          There is no plan to create a scripting reference PDF. You use VB--I'd expect you'd use the Object Browser to view objects/properties/methods. In previous versions, we've used the reference to attempt to add/fix information--but, this time, we edited the source to add the information to the objects you see in the Object Browser.

                          Thanks,

                          Ole
                          • 10. Re: With CS3, some things have changed
                            Community Member
                            > That said, I don't know of too many scripts
                            > that rely on the order of selection.

                            - script to thread separate TextFrames as Story
                            - script to convert layout to database - user select TextFrame with title and Rectangle (with photo) and next TextFrame with Description ... yes - this could be done by checking of applied Char/Para styles to texts - but selection order is better - and fastest - way ;)
                            - script to reorder objects - last selected object is "reference point"

                            robin

                            --
                            www.adobescripts.com
                            • 11. Re: With CS3, some things have changed
                              This JavaScript line no longer works in CS3:

                              app.palettesVisible = false;

                              Does anybody know how to do this in CS3???
                              • 12. Re: With CS3, some things have changed
                                Community Member
                                go to http://www.kahrel.plus.com/indesignscripts.html and download "Script dictionary (PDF) CS3"
                                there is Panels collection - I think it is what you are looking for ;)

                                robin

                                --
                                www.adobescripts.com
                                • 13. Re: With CS3, some things have changed
                                  Community Member
                                  Hmmm.

                                  app.panels.everyItem().visible = false;

                                  seems to make all panels hide except the Pages panel -- is that a bug (see PS)? But:

                                  app.panels.everyItem().visible = true;

                                  makes literally every panel visible, not just the active set. Aha, but there is an app.applyWorkspace method. But no Workspace object, so I don't think you can find out what ones are available from a script.

                                  Dave

                                  PS: the second time I tried hiding panels with the above script, the Pages panel went as well, so perhaps not a bug but a transient problem.
                                  • 14. Re: With CS3, some things have changed
                                    Community Member
                                    My plan for this topic has changed. I'm going to let it meander as it will and then in a month or two when we've gathered all the information we can, I'll post a new topic to replace this one, containing just the facts with as little editorial discussion as possible. At that point, I'll release this one to drift down the list and eventually to disappear, just like any other topic.

                                    Dave
                                    • 15. Re: With CS3, some things have changed
                                      sstanleyau Community Member
                                      Not really a scripting change, but useful for scripters nonetheless:<br />flipping is still done by changing the vertical scale of graphics to a<br />negative value (and rotating if necessary), but as of CS3 this is shown in<br />the UI; CS2 used to just show the absolute value for vertical scale, which<br />could be very confusing.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Denver, June 2007 <a href=http://scriptingmatters.com/aspro>
                                      • 17. Re: With CS3, some things have changed
                                        Community Member
                                        In CS2 and before, when you get the width of a merged cell, it actually gives you the width of the first column containing the cell. In CS3, you get the width of the merged cell.

                                        This also affects the height property. I just never felt the urge to try this on a merged cell in CS2 before. You get the height of of the first row in CS2 but the height of the merged cell in CS3.

                                        Note that in CS3, if for some reason you want the width of the first column or the height of the first row of a merged cell, it's easy enough to obtain those values.

                                        For scripting tables, this is a big improvement -- pity my client is still using CS2 though!

                                        Dave
                                        • 18. Re: With CS3, some things have changed
                                          pkahrel MVP
                                          CS2's applyStyle() has been split into applyCharacterStyle(stylename) and applyParagraphStyle(stylename, override).

                                          Peter
                                          • 19. Re: With CS3, some things have changed
                                            engco
                                            After racking my brains about why a script was failing I discover that:

                                            storyOffset returns a number (character offset in story) in CS2 but returns an insertionPoint in CS3.
                                            • 20. Re: With CS3, some things have changed
                                              sstanleyau Community Member
                                              In CS2, this:<br /><br />    tell document 1<br />        tell parent story of text frame "Table frame"<br />            make table<br />        end tell<br />    end tell<br /><br />would make a table enclosing the contents of the story. In CS3, it makes a<br />table at the beginning of the story (or the end, if you target the contents<br />of a text frame). You need to use "convert to table" instead.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au><br />AppleScript Pro Denver, June 2007 <a href=http://scriptingmatters.com/aspro>
                                              • 21. Re: With CS3, some things have changed
                                                Community Member
                                                Hello,

                                                I'm working with VBscript.

                                                Is there a difference between cell.associatedXmlElement in CS2 and CS3?
                                                All my cells in CS2 had an associatedXmlElement.
                                                In CS3, my table has an associatedXmlElement, but all its cells don't (The value is Nothing)
                                                Is this a bug? Is it linked with XML evolution?

                                                Thanks a lot
                                                • 22. Re: With CS3, some things have changed
                                                  Community Member
                                                  I have a question about CS3 and CS2 compatibility:

                                                  We've got an application wich works (gets text content and saves new one) with CS2 documents (.indd). We use InDesign Server CS2.

                                                  Now we've got to add support of CS3 documents. As I understand, the only way here is to Use InDesign Server CS3. Client InDesign CS3 (seems) opens CS2 documents without problems. Question is: will scripts for InDesign CS3 work correctly with documents created by InDesingn CS2 or are there some issues?
                                                  • 23. Re: With CS3, some things have changed
                                                    Community Member
                                                    Hello everybody looks like new version of InDesign CS3 provides us new nice bugs, stuff which has been working in the other versions before. I'm using VB script.

                                                    If you copy, move or duplicate a group of textframes to another document via scripting the textframe options of the textframes in the group are lost and set back to default, only one textframe is keeping the individual options. You have the same problem if you dont group, but select different textframes at once and then copy.

                                                    The second bug is similar, if you have a group of objects containing an image and you set new geometric bounds via scripting the image itself is not moved to the new position, but stays in the old position. If you take the move command (been broken in version CS) it is working.

                                                    The last thing, I can't understand why didn't Adobe fix the bug from CS2, that oXMLElement.PageItems.Count always gives back 0, in CS it was working fine.
                                                    • 24. Re: With CS3, some things have changed
                                                      Community Member
                                                      Hi I just upgraded from InDesign 1.5(! Adobe, it would seem would like to forget that this version ever existed). I have a script written in Visual Basic 6 (! I would like to forget that this version of VB ever existed). How do i convert to CS3. I noticed some reference to versioning. Can I use my 1.5 style script for the time being? Where do I find the dll so I can set the correct 'Reference' in VB6? (I downloaded the software).

                                                      A lot of questions, I know, but I basically need to know how to make Scripting w/ VB6 work in InDesign CS3.

                                                      Thanks,
                                                      • 25. Re: With CS3, some things have changed
                                                        Community Member
                                                        Mark,

                                                        You would get a better response, I suspect, if you:

                                                        1. Posted in a new thread. This one was supposed to be for people converting from CS2 -- there's a similar one for people going from CS to CS2. We don't go back to 1.5, though.

                                                        2. Provide some details about your script. Have you tried it on CS3? What happens.

                                                        But answer those questions as part of your new topic, please, not here.

                                                        Dave
                                                        • 26. Re: With CS3, some things have changed
                                                          Harbs. MVP
                                                          cornerEffect became cornerOption.

                                                          (You can't help but wonder why they make changes like this)

                                                          Harbs
                                                          • 27. Re: With CS3, some things have changed
                                                            Community Member
                                                            Perhaps because transparency became effects in the UI?

                                                            Dave
                                                            • 28. Re: With CS3, some things have changed
                                                              Community Member
                                                              Harbs wrote: "(You can't help but wonder why they make changes like this)"

                                                              We can't win. If we leave something named as it was when the UI changes (e.g., "oval" when the UI changed to say "ellipse"), people get upset. If we change something to match the UI (e.g., "effect" to "option"), we upset people.

                                                              The UI designers are always changing the names of things--I assume it's to make the interface better or more consistent. We try to match their terms whenever possible.

                                                              Thanks,

                                                              Ole
                                                              • 29. Re: With CS3, some things have changed
                                                                Harbs. MVP
                                                                I'm not *really* complaining. I suppose for new scripters it's nice to
                                                                have the terms matching the interface, but I'm trying to write scripts
                                                                which work in CS, CS2, and CS3. I really don't care what the exact
                                                                terminology of what these things are, but to have them work in all
                                                                versions of CS, I have to do a lot of if (app.version...). The less I
                                                                have to do this, the happier I am.

                                                                I appreciate all the hard work. And you can't make everyone happy all
                                                                the time... ;-)

                                                                Harbs
                                                                • 30. Re: With CS3, some things have changed
                                                                  Community Member
                                                                  Hi Harbs,

                                                                  Does script versioning make your life any easier?

                                                                  Thanks,

                                                                  Ole
                                                                  • 31. Re: With CS3, some things have changed
                                                                    Harbs. MVP
                                                                    Sometimes. Maybe I should use it more often, but especially with CS3,
                                                                    there are a lot of situations where versioning doesn't work. (Styles to
                                                                    name one...)

                                                                    Harbs
                                                                    • 32. Re: With CS3, some things have changed
                                                                      Community Member
                                                                      Hi to everyone

                                                                      does anyone know where to find this:
                                                                      ShadowBlendMode, ShadowBlurRadius, ShadowColor, ShadowMode, ShadowNoise, ShadowOpacity, ShadowSpread, ShadowXOffset, ShadowYOffset in CS3?

                                                                      I know it is the question but the answer will show changes between CS2 and CS3 - thx

                                                                      regards
                                                                      • 33. Re: With CS3, some things have changed
                                                                        Community Member
                                                                        They've got snappier names in CS3 but they're harder to find:

                                                                        Obj.transparencySettings.dropShadowSetting.angle; .blendMode, etc.

                                                                        I don't see a blurRadius, but maybe it has a different name.

                                                                        Dave
                                                                        • 34. Re: With CS3, some things have changed
                                                                          Harbs. MVP
                                                                          > I don't see a blurRadius, but maybe it has a different name.
                                                                          >
                                                                          It's called "size"...

                                                                          Harbs
                                                                          • 35. Re: With CS3, some things have changed
                                                                            Community Member
                                                                            Here are a couple of examples from a script I wrote last week of placing a library asset. The first is placed on (the active page of) a document:

                                                                            >myAsset.placeAsset(myDoc);

                                                                            In this second example, the asset is anchored at an insertion point:

                                                                            >myAsset.placeAsset(myStory.insertionPoints[myIndex]);

                                                                            In CS2, you had to select an insertionPoint to place as an anchored item.

                                                                            Dave
                                                                            • 36. Re: With CS3, some things have changed
                                                                              Community Member
                                                                              Hello,

                                                                              I'm working in VB.
                                                                              Has anyone tried to convert rows from table into header row?
                                                                              It works fine with footer, but doesn't want to convert a row to header.

                                                                              Is this a bug? will it soon be fixed?

                                                                              Thanks
                                                                              Anne Laure
                                                                              • 37. Re: With CS3, some things have changed
                                                                                Community Member
                                                                                I will be traveling on business beginning Saturday the 13th of October and will have limited access to my email. I will be back in the office on Monday the 22nd of October. For emergencies please contact sales@anodos.gr, or call mob: +30 6977 215264.

                                                                                Thank you.
                                                                                • 38. Re: With CS3, some things have changed
                                                                                  Community Member
                                                                                  If you use this code to resize a group in CS2:
                                                                                  myGroup = app.selection[0];
                                                                                  
                                                                                  myBounds = myGroup.visibleBounds;
                                                                                  myBounds[2] = myBounds[0] + 1;
                                                                                  myGroup.visibleBounds = myBounds;
                                                                                  the strokes in the group are scaled (irrespective of the Transform Content setting). But in CS3, the strokes are simply moved to fit within the same bounds.

                                                                                  I happened upon this because I wanted the CS3 behavior, but I'm writing a script for a client still using CS2. So, I'm going to have to instead move the elements inside the group to get them where I want them to be.

                                                                                  Dave
                                                                                  • 39. Re: With CS3, some things have changed
                                                                                    Possibly a silly question here but my CS2 scripts don't work in CS3 at all (just upgraded yesterday) even when there are examples of similar scripts in the CS3 Guide.

                                                                                    For example:

                                                                                    myDoc = app.activeDocument;
                                                                                    var myPage = myDoc.pages.item(0);

                                                                                    The above script works in CS2 but it gives the error "undefined is not an object" in CS3. There are examples of similar scripts in the CS3 Guide but they don't work either and give the same error when I cut and paste into ExtendScript Toolkit 2. Does anyone have any advice what I should do?
                                                                                    1 2 Previous Next