6 Replies Latest reply on Jun 21, 2011 4:01 AM by Laubender

    [CS5][JS] Bookmark name problem (Bug?)

    JohnDevlon Level 1

      Hi,

       

      Can anyone please help me?

       

      I'm trying to create a bookmark from a text selection. When running the script from indesign, in 80% of the tests, the name will not change to the selected text. In 20% of the cases it does change the name. I can't find any reason why. There is no pattern. No error occurs when running the script. When encapsulation the script in a try/catch, no exception is thrown.

       

      When running the script from extendscript toolkit it ALWAYS works. It's driving me nuts.

       

      The code:

       

       

                                      var myText = app.selection[0].contents;

       

                                      var myDoc = app.activeDocument;

                                      var currPage = app.selection[0].parentTextFrames[0].parentPage;

       

                                      var curBookmark = myDoc.bookmarks.add(currPage);

                                      curBookmark.label = myText;

                                      curBookmark.name = myText;

       

       

      Any help would be great.

       

      John