1 2 Previous Next 69 Replies Latest reply: Jan 25, 2010 12:33 AM by Andreas Jansson Go to original post RSS
      • 40. Re: With CS3, some things have changed
        Community Member
        You're running from ESTK 2? Did you remember to target InDesign?

        Dave
        • 41. Re: With CS3, some things have changed
          That was the issue Dave (I thought I had done this but I didn't).

          Now I can start debuging these scripts, I hope...
          • 42. Re: With CS3, some things have changed
            Community Member
            I'm starting to 'rebuild' some of my scripts to work with CS3 and have run into a few issues. I have solved a couple but I cannot find anything on the following:

            for (i = myDataTable.rows.length-1; i >= 0; i--){
            elecType = electionType.rows[i].cells[1].texts[0].contents;
            if (elecType == "Postal"){
            myTable.rows[i].cells[0].texts[0].contents = municipalityName.cells[i].texts[0].contents;
            myTable.rows[i].cells[1].texts[0].contents = electionType.cells[i].texts[0].contents;
            myTable.rows[i].cells[2].texts[0].contents = wardNumber.cells[i].texts[0].contents;
            myTable.rows[i].cells[3].texts[0].contents = wardName.cells[i].texts[0].contents;
            myTable.rows[i].cells[4].texts[0].contents = positions.cells[i].texts[0].contents;
            myTable.rows[i].cells[5].texts[0].contents = candidates.cells[i].texts[0].contents;
            myTable.rows[i].cells.everyItem().texts[0].applyStyle(myDoc.paragraphStyles.item("Normal") , false);}

            Apart from this taking forever to run, the last line returns the error "is not a function".

            Is there a better way to apply a style to certain cells throughout a table based on a corresponding cell value?
            • 43. Re: With CS3, some things have changed
              pkahrel MVP
              >the last line returns the error "is not a function".

              You now have to say applyParagraphStyle (...) or applyCharacterStyle (...).

              >Is there a better way to apply a style to certain cells throughout a table ...?

              Don't think so. But comparable script I use to apply styles to tables are quick enough for me. Have you tried saving the document on itself (the equivalent of "Save As" in the UI) to delete the undo history? That could speed up any script. Another issue is the size of the table: if it's very large, the script will take some time.

              Peter
              • 44. Re: With CS3, some things have changed
                Community Member
                Thanks Peter,

                The table is pretty large (about 350 rows by 10 columns). In CS2 the entire script takes about 2 minutes to run which is fine because it's not a script I will be running too often. However in CS3 it takes about 2 minutes to let me know there was an error with the first function. But hopefully when I work out the changes required to update to CS3 it won't take any longer than the CS2 version, plus I now have a Core 2 Duo 2.3ghz instead of the P4 3ghz so I'm hoping this might speed things up a tad.
                • 45. Re: With CS3, some things have changed
                  Community Member
                  Hi guys,

                  I am having some issues with text overflows within a group. I wrote the following script in CS2 and it worked well but I get an undefined error in CS3.

                  // Grouped Overset Text
                  function resizeOverset(){
                  myStories = myDoc.stories;
                  for (var j = myStories.length - 1; j >= 0; j--){
                  while (myStories[j].overflows == true){
                  myFrame = myStories[j].texts[0].parentTextFrames[0];
                  myTextFrameSize = myFrame.geometricBounds; // error on this line
                  myTextFrameSize[2]=myTextFrameSize[2]+5;
                  myFrame.geometricBounds=myTextFrameSize;
                  }}}

                  I can get around this by ungrouping but I need to keep the groups.

                  // Ungrouped Overset Text
                  function resizeOverset(){
                  for (i=app.activeDocument.groups.length-1;i>=0;i--){
                  app.activeDocument.groups[i].ungroup();
                  }
                  myStories = myDoc.stories;
                  for (var j = myStories.length - 1; j >= 0; j--){
                  while (myFrames[j].overflows == true){
                  var myTextFrame = myFrames[j];
                  myTextFrameSize = myTextFrame.geometricBounds;
                  myTextFrameSize[2]=myTextFrameSize[2]+5;
                  myTextFrame.geometricBounds=myTextFrameSize;
                  }}}

                  Can I resize the geometricBounds while the textFrames are grouped in CS3?
                  • 46. Re: With CS3, some things have changed
                    Kasyan Servetsky Community Member
                    Hi Brett,
                    Your 1st function – Grouped Overset Text – works for me in CS3. But I’d do it like this:


                    var myDoc = app.activeDocument;
                    resizeOverset();

                    function resizeOverset(){
                       myStories = myDoc.stories;
                       for (var j = myStories.length - 1; j >= 0; j--){
                          if (myStories[j].overflows == true){
                             // fit to content the last text frame in the thread
                             myLastFrame = myStories[j].texts[0].parentTextFrames[myStories[j].texts[0].parentTextFrames.length - 1];
                             myLastFrame.fit (FitOptions.FRAME_TO_CONTENT);
                          }
                       }
                    }

                    Kasyan
                    • 47. Re: With CS3, some things have changed
                      Community Member
                      Thanks Kaysan, that works a treat and it's fast too.
                      • 48. Re: With CS3, some things have changed
                        Harbs. MVP
                        flipItem()

                        In CS3 it's missing the transformingContent parameter. :( (Why, oh why is it missing...) I couldn't think of any simple and straightforward way to flip just the frame without the content.

                        Other than checking for every kind of possible content, and doing a double flip, this function was all I could come up with to replace the functionality:

                        (Please let me know if I missed something obvious!)
                        function FlipFrameWithContent(frame,flipDirection,anchorPoint,applyToContent){
                        
                          if(applyToContent){
                            frame.flipItem(flipDirection,anchorPoint);
                            }
                          else{
                            var newFrame = frame.duplicate();
                            newFrame.flipItem(flipDirection,anchorPoint);
                            for(var i=0;i<frame.paths.length;i++){
                              frame.paths[i].entirePath=newFrame.paths[i].entirePath;
                              }
                            newFrame.remove();
                            }
                          }
                        • 49. Re: With CS3, some things have changed
                          Community Member
                          This is one from Ole from a while back. Anyone have a minute to tweak this for CS3?

                          Many thanks!!

                          tell application "Adobe InDesign CS3"
                          set myStyles to every paragraph style of document 1
                          set find preferences to nothing
                          set change preferences to nothing
                          set myStyles to rest of myStyles -- dump "No Style"
                          repeat with myStyle in myStyles
                          search document 1 for "" replacing with "" with find attributes {applied paragraph style:myStyle} with change attributes {applied paragraph style:myStyle}
                          end repeat
                          end tell
                          • 50. Re: With CS3, some things have changed
                            Community Member
                            I've been using .search() for a lot of our catalog caption generation and this seems to have changed or have been removed in CS3? (I can't find the JS reference that existed for CS2 in a CS3 version... any pointers there? The documents on the Adobe site seem to be more tutorial style than references).

                            The code below uses a placed group of textframes from the library, places them, and then puts the text where the placeholders are. Any idea why .search() is no longer a function of parentStory?

                            captionPlaced.textFrames[0].parentStory.search(
                            '**LOT**',
                            false,
                            false,
                            itemData['Lot_Number'],
                            {},
                            {'appliedParagraphStyle':'Lot Number'}
                            );
                            • 51. Re: With CS3, some things have changed
                              [Jongware] MVP
                              That's a well-known change from CS2 to '3.

                              The old search has been replaced with the triplet findText, findGrep, and findGlyph. These return an array of found items jsut as search did. They don't do the replacement anymore (thanks for that!), you've got real changeText, changeGrep, and changeGlyph methods now.

                              Check any text related property in the ESTK2 Help[*] -- Story, Text, Paragraph, Word -- there it is.

                              [*] The ID CS3 Model help is lurking in the Help menu there. Browse this forum for more info on that.
                              • 52. Re: With CS3, some things have changed
                                Community Member
                                thanks jongware! i think this shows that either me or adobeforums.com suck at searching.
                                • 53. Re: With CS3, some things have changed
                                  [Jongware] MVP
                                  If you dislike the ESTK help browser -- people do, apparently ;-) -- try this: http://www.jongware.binaries.indesigncs3jshelp.zip

                                  It's a hyperlinked set of HTML, the product of my own homegrown XSLT, let loose on the full XML help (which should be somewhere on your hard disk).

                                  For a full description and some of the limitations, and some praise as well, see the full thread here: http://www.adobeforums.com/webx?7@@.3bbf275d.3bc44040/12
                                  • 54. Re: With CS3, some things have changed
                                    sandeecohen ACP/MVPs
                                    I just got an email from a student who complains that the keyboard shortcut to open/close the Tabs panel no longer closes the panel. (A change in behavior from CS2 to CS3.)

                                    Setting up a new keyboard shortcut for the Tabs panel command does not help.

                                    I would like to offer the option to my student to use a script to open or close the Tabs panel. But I haven't a clue as to how to write such a thing.

                                    I doubt it is too complicated, and should be helpful for others.
                                    • 55. Re: With CS3, some things have changed
                                      pkahrel MVP
                                      Sandee,

                                      Scripts can't open and close panels in the UI. But you can use the Esc key to close the Tab panel.

                                      Peter
                                      • 56. Re: With CS3, some things have changed
                                        sandeecohen ACP/MVPs
                                        Duhhhhh, how obvious!
                                        • 57. Re: With CS3, some things have changed
                                          sstanleyau Community Member
                                          On 13/3/08 3:19 AM, "Peter Kahrel" <member@adobeforums.com> wrote:<br /><br />> Scripts can't open and close panels in the UI.<br /><br />How about toggling their visible property? Of course it's academic here,<br />because (a) you've given a better solution, and (b) the tabs dialog isn't a<br />panel.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
                                          • 58. Re: With CS3, some things have changed
                                            pkahrel MVP
                                            >How about toggling their visible property?

                                            Right -- hadn't thought about that. Bit of a rash overgeneralisation that the UI isn't available to scripts, which obviously is nonsense given that you can add and remove menu items and toggle panels.

                                            Peter
                                            • 60. Re: With CS3, some things have changed
                                              Community Member
                                              Hello All,

                                              I want to create 100 Pages in the template using Master A. Right now i am doing manually to create 100 Pages and linking manually. I want to do this in a automized way.

                                              What is the better way to do this. May be via script or via Manullay with single button like that i don't want to do each and every page manually.

                                              Can any body thru something about this and suggest me to do this.

                                              Thanks in advance
                                              Selva
                                              • 61. Re: With CS3, some things have changed
                                                Community Member
                                                this code works in CS2 but i doesn't work in cs3 if the insertion point of the frame is overset.

                                                --You must have selected a text frame with text inside it
                                                tell application "Adobe InDesign CS2"
                                                tell active document
                                                set frame to object reference of selection
                                                set insertion_point to object reference of end of last paragraph of parent story of frame
                                                tell insertion_point
                                                make text frame with properties {contents:"Inline text frame", geometric bounds:{"0mm", "0mm", "25mm", "41mm"}}
                                                end tell
                                                end tell
                                                end tell
                                                • 62. Re: With CS3, some things have changed
                                                  Community Member
                                                  I am a first day newb to scripting. I need to simply use find/change to delete several instances of text and in one case replace text with a tab. I wan't these to run concurrently. I can't seem to get the findchangelist script to even run after editing the FindChangeList.txt file. I'm using the script that shipped with the application. where can I find a simple tutorial in kindergarten english on the subject?
                                                  • 63. Re: With CS3, some things have changed
                                                    Community Member
                                                    Hi SethMcGraw,

                                                    There's a chapter in the Scripting Guide on text and type that includes several find/change examples. The corresponding scripts are available in the Zip archive containing all of the Scripting Guide scripts. Both are available at the InDesign scripting home page--you'll find a link at the top of the forum.

                                                    There's also a new version of FindChangeByList available at the same link.

                                                    Thanks,

                                                    Ole
                                                    • 64. Re: With CS3, some things have changed
                                                      Community Member
                                                      how to convert bottom statement from cs2 to sc3

                                                      phcode.Rotate (deg)
                                                      • 65. Re: With CS3, some things have changed
                                                        Community Member
                                                        Hello, I am currently studying InDesign CS3 at Conestoga College in Waterloo, Ontario. I want to congratulate Olav Kvern and Dave Blatner on their Real World InDesign text. It is very well done, and I welcome the many humorous asides. A point of interest: Ken Graham, a professor at the University of Guelph, is a leading authority on William Beckford and is working on a scholarly edition of 'Vathek' and the 'Episodes of Vathek'. My interest in InDesign centers on its usefulness in setting mathematical articles via the InMath plugin. The javascript and XML support looks good too.
                                                        • 66. Re: With CS3, some things have changed
                                                          Community Member
                                                          So, we're a little behind...we're just moving from CS2 to CS3. So please bear with me. (We're using Javascipt)

                                                          Until I'm able to convert all of our scripts to CS3 compatibility, I created a "Version 4.0" folder in the scripts panel, hoping I can use our CS2 scripts as-is.

                                                          One of my CS2 scripts places a snippet on the master pages. Before, it would place by itself with no questions asked. In CS3, the snippet is a loaded cursor wanting me to click to place it. What do I need to change? This is the section of the script

                                                          //Place Master Page items
                                                          myDocument.masterSpreads.item("A-Master").place(
                                                          mcmMasterPage, //the document
                                                          [0,0], //top-left coordinate of text frame
                                                          undefined, //layer
                                                          false, //show options
                                                          false ) //autoflow
                                                          • 67. Re: With CS3, some things have changed
                                                            Andreas Jansson Community Member

                                                            Trying to update some scripts and I found a few things I don't recall reading in this thread:

                                                            1. Trying to create xmlTag that already exists raises error in CS3

                                                            In CS3 (and CS4) you get an error trying to create xml tags that already exist:

                                                             

                                                            myDocument.xmlTags.add(sTag)
                                                            Error: A tag with that name already exists.  Please choose a different name.

                                                             

                                                            (while in CS2 the same code just returned the existing tag without an error)

                                                             

                                                             

                                                             

                                                            2. Several parents and markupTags for an xmlElement

                                                            xmlElement can have several parents. The parent propery is then returned as an array. The same goes for tags.

                                                            Having more than one element with the same name, and assuming that there is only one by using myElement.item(the duplicate name here) you seem to get a single xmlElement but it has for example several markupTags (markupTag can be an array in CS3 and later).

                                                            • 68. Re: With CS3, some things have changed
                                                              AdobeScripts Community Member

                                                              Andreas Jansson wrote:

                                                               

                                                              Trying to update some scripts and I found a few things I don't recall reading in this thread:

                                                              1. Trying to create xmlTag that already exists raises error in CS3

                                                              In CS3 (and CS4) you get an error trying to create xml tags that already exist:

                                                               

                                                              myDocument.xmlTags.add(sTag)
                                                              Error: A tag with that name already exists.  Please choose a different name.

                                                               

                                                              (while in CS2 the same code just returned the existing tag without an error)

                                                              Don't "add" tag - just use it in taggin process:

                                                               

                                                                  With myXMLelem.XMLElements.Add("character")
                                                                      Call .XMLAttributes.Add("type", "text")
                                                                      .Contents = "empty paragraph" & vbCr
                                                                      Call .XMLAttributes.Add("aid:cstyle", .Texts.Item(1).AppliedCharacterStyle.Name)
                                                                  End With

                                                               

                                                              or

                                                               

                                                                  With myTSRangeText.AssociatedXMLElements.Item(1).Parent.XMLElements.Add("character")

                                                                      Call .Markup(myTSRangeText)

                                                                      Call .XMLAttributes.Add("type", "text")

                                                                      Call .XMLAttributes.Add("aid:cstyle", myTSRangeText.AppliedCharacterStyle.Name)

                                                                      If .Parent.MarkupTag = "character" Then

                                                                          Call .Move(idLocationOptions.idAfter, .Parent)

                                                                      End If

                                                                  End With

                                                               

                                                              2. Several parents and markupTags for an xmlElement

                                                              xmlElement can have several parents. The parent propery is then returned as an array. The same goes for tags.

                                                              Having more than one element with the same name, and assuming that there is only one by using myElement.item(the duplicate name here) you seem to get a single xmlElement but it has for example several markupTags (markupTag can be an array in CS3 and later).

                                                              Few .parents ? Or you are talking about .AssociatedXMLElements collection for Text object ?

                                                               

                                                              robin

                                                              www.adobescripts.com

                                                              • 69. Re: With CS3, some things have changed
                                                                Andreas Jansson Community Member

                                                                No 1. I might want to create tags (in the tags palette), first, for one reason or another :-)

                                                                That is, not in the immediate tagging process.

                                                                No matter the reason: there is an add method on the tags collection, and as I see it, it was changed ... and this is the place to record it.

                                                                 

                                                                No 2 is about having a reference to an xmlElement object in the structure (XML tree).

                                                                Also, I forgot to mention that I'm using javascript, so there might be differences in how the objects are returned.

                                                                 

                                                                To illustrate, here is a piece of my code. I have a reference to an xmlElement object in the tree. Let's call it elemToFind:

                                                                 

                                                                    if(elemToFind.index.length>1){
                                                                         // If elemToFind is not a single object, get its FIRST parent using [0], and go down again to get a SINGLE instance of the object instead.
                                                                        elemToFind = elemToFind.parent[0].xmlElements.item(elemToFind.index[0]);
                                                                        alertAndLog('The XML element "' + elemToFind.markupTag.name + '" exists more than once, under the same node.');
                                                                    }
                                                                
                                                                

                                                                 

                                                                The elemToFind was set (as I wrote in the previous message) using the item() method of its parent.

                                                                If the XML structure looks like this:

                                                                Root

                                                                  Sibling1

                                                                  Sibling2

                                                                  Sibling2

                                                                  Sibling3

                                                                 

                                                                ... then I experienced this problem when setting a reference to elemToFind = myParent.item('Sibling2')

                                                                Causing elemToFind to behave differently from CS2, where you automatically got a single object reference set to one of the "Sibling2" objects, the first I think.

                                                                 

                                                                As you see in the sample code elemToFind.parent is no longer a single object. Probably caused by the new nature of the object returned by xmlElement.item()

                                                                 

                                                                (I might also have got the mening of "several" wrong, sorry for the confusion. I meant >1).

                                                                 

                                                                Andreas

                                                                1 2 Previous Next