25 Replies Latest reply on Oct 16, 2009 8:14 PM by jay fresno

    Insert list of link names on current page at current text insertion point?

    Dizz Hicks Level 1

      Hello,

       

      I need to automate the insertion of a list of the names of the links that are on the current / active page, at the current text blinker. (I forget the technical name for the text blinker line thing.)

       

      Thanks!

        • 1. Re: Insert list of link names on current page at current text insertion point?
          [Jongware] Most Valuable Participant

          That would be "cursor" (apparently taken from Latin, "messenger"; not someone who curses a lot).

           

          This javascript does the trick. It first tries to determine the page, which is slightly bothersome as text frames may be nested, on a master page, or on the pasteboard. If the script "does nothing, then quits" (quite a common error) or errors out, this would be a likely place to fail.

           

          If it did find its own page it's a simple case of iterating over all graphics on that page, which fortunately is a property of "Page".

           

          theStoriesPage = app.selection[0].parentTextFrames[0];
          while (1)
          {
           theStoriesPage = theStoriesPage.parent;
           if (theStoriesPage.constructor.name == "Page")
            break;
           if (theStoriesPage.constructor.name == "Character")
            theStoriesPage = theStoriesPage.parentTextFrames[0];
           if (theStoriesPage.constructor.name == "Spread" || theStoriesPage.constructor.name == "MasterSpread")
            exit(0);
          }
          for (all=0; all<theStoriesPage.allGraphics.length; all++)
           app.selection[0].contents = (all ? " " : "")+theStoriesPage.allGraphics[all].itemLink.name;
          
          • 2. Re: Insert list of link names on current page at current text insertion point?
            Dizz Hicks Level 1

            I initially wrote "cursor" but then it occurred to me that the cursor is the pointer that moves with the mouse, not where the current text insertion point is, isn't it? Does anyone remember the TV series Automan? I digress.

             

            I cut and pasted your code into ExtendScript Toolkit 2, tried it in ID, and it doesn't work; nothing happens. I should have mentioned I'm using CS3 in case that would make a difference...?

             

            Thanks.

            • 3. Re: Insert list of link names on current page at current text insertion point?
              [Jongware] Most Valuable Participant

              I tested it under CS4, but the underlying machinery did not change too much from CS3; if it did, you'd get an error complaining about "unknown object" or something like that.

               

              Are you sure you are using it correctly? (If you don't mind me asking ) If I put the text cursor into a text frame on a page with any imported graphic image on it, then run the script, I do get the name of that file. Perhaps you are trying to run if from within the ESTK, instead of from within ID?

              • 4. Re: Insert list of link names on current page at current text insertion point?
                Dizz Hicks Level 1

                Ah-ha. Figured out why it wasn't working for me: my text frame is on the pasteboard. It works if the frame is on the page. Any hope of getting it working with the text frame on the page's pasteboard?

                 

                Also, is getting a return between the names a simple thing...?

                 

                Thank you, thank you.

                • 5. Re: Insert list of link names on current page at current text insertion point?
                  Dizz Hicks Level 1

                  Expanded thought:

                   

                  Is there a way of getting that list of links, a double-break, then bleed and page size info?

                   

                  I'd like to apply style to all that too: font sizes, colours...

                  e.g.:

                   

                  IMAGE FILES

                  heresapicture.jpg


                  BLEED

                  0.125"


                  TRIM

                  6" x 4"

                   

                   

                  Forget that bit if I'm asking too much! Which I feel I am.

                   

                   

                  Thanks.

                  • 6. Re: Insert list of link names on current page at current text insertion point?
                    [Jongware] Most Valuable Participant

                    Technically, it's all possible -- with one important exception! The script needs to know on which page to look -- so that's why I explicitly test if the text frame is on a page, rather than -- yes -- on the pasteboard. If an item is on the pasteboard, it's not 'on' a page ...

                     

                    Would you be satisfied if I just pointed you to ways of improving the script? (for the weekend, at least)

                     

                    You can change the space inbetween items into a hard return by using '\r' -- for example, in this fragment, change

                     

                    all ? " " : "")+ ...

                     

                    to

                     

                    all ? "\r" : "")+ ...

                     

                    [FYI: The "? .. :" operator 'returns' the first argument if the expression before it evaluates to 'true', the 2nd if 'false'. Since zero equals 'false' and all other numbers equal 'true', this fragment will "insert" an empty string before the first (= numbered '0') file name, and a space --or hard return-- before all others, effectively putting stuff inbetween items, but not before the first or after the last.]

                     

                    You can insert any text you want into a text frame's "contents" -- including hard returns, as shown -- but they will all have the same text attributes and styling, taken from the 'active' one when you create the text frame. To change the style half-way, you need to end the last string with a hard return, then set the insertionpoint's "appliedParagraphStyle" to another one. Any following text you insert will have that style instead (until you change it again). Search the forum; I seem to remember I used that somewhere.

                     

                    Your other information can be found in the active document 's "documentPreferences" -- it has properties pageWidth and pageHeight (describing the actual document size) and documentBleedTopOffset (you don't have to check all other sides if they are the same). This little script shows how you can retrieve the values:

                     

                    alert ("Size: "+app.activeDocument.documentPreferences.pageWidth

                    +"; Trim: "+app.activeDocument.documentPreferences.documentBleedTopOffset

                    +"; total: "+app.activeDocument.documentPreferences.pageWidth

                    +app.activeDocument.documentPreferences.documentBleedTopOffset);

                     

                    (Note how I switch between 'adding', i.e. concatenating, strings, and adding numbers to get that last value.)

                     

                    Hope it helps!

                    • 7. Re: Insert list of link names on current page at current text insertion point?
                      Dizz Hicks Level 1

                      That's a whole lot of help. Many thanks.

                       

                      Here's where I am:

                       

                      theStoriesPage = app.selection[0].parentTextFrames[0];

                      while (1)

                      {

                      theStoriesPage = theStoriesPage.parent;

                      if (theStoriesPage.constructor.name == "Page")

                        break;

                      if (theStoriesPage.constructor.name == "Character")

                        theStoriesPage = theStoriesPage.parentTextFrames[0];

                      if (theStoriesPage.constructor.name == "Spread" || theStoriesPage.constructor.name == "MasterSpread")

                        alert ("For this script to work, the text box must be on the page itself."); exit(0);

                      }

                      app.selection[0].contents = "LINKED IMAGE(S):\r";

                      for (all=0; all<theStoriesPage.allGraphics.length; all++)

                      app.selection[0].contents = (all ? "" : "")+theStoriesPage.allGraphics[all].itemLink.name+"\r";

                      app.selection[0].contents = ("\rSIZE:\r"

                      +app.activeDocument.documentPreferences.pageWidth

                      +"˝ × "

                      +app.activeDocument.documentPreferences.pageHeight+"˝\r"

                      +"\rBLEED:\r"

                      +app.activeDocument.documentPreferences.documentBleedTopOffset+"˝");

                       

                       

                      To continue my type styling enquiry, I'd like to make the whole lot Helvetica, the information 20pt and the headings bold and 30pt. (No paragraph styles.)

                      I've tried! I've Googled to no avail. (Is there a reference manual that covers all this somewhere online?)

                      I imagine it'll be a something.Font == "Helvetica" etc, etc... if you can help me out hopefully one last time, I'd appreciate it.

                       

                      Thanks in advance.

                      • 8. Re: Insert list of link names on current page at current text insertion point?
                        [Jongware] Most Valuable Participant

                        Looking good so far!

                         

                        There are only two tricks to remember when inserting and styling text. First is, you only have to set all text attributes once at the last 'insertion point'. They'll keep on going until you change it to something else. The other is, only do so after a hard return (and that's only mandatory when using paragraph styles -- which you are not using). [see note!]

                         

                        Add this before your very first text insertion:

                         

                        app.selection[0].insertionPoints[-1].appliedFont = "Helvetica";
                        app.selection[0].insertionPoints[-1].fontStyle = "Bold";
                        app.selection[0].insertionPoints[-1].pointSize = 30;
                        

                        and everything after that will be Helvetica Bold, 30 pts. Too much? Well, insert your heading

                         

                        app.selection[0].contents = "LINKED IMAGE(S):\r";
                        

                        then set the new text attributes:

                         

                        app.selection[0].insertionPoints[-1].fontStyle = "Regular";
                        app.selection[0].insertionPoints[-1].pointSize = 20;
                        

                        and insert more text until the next heading. Repeat as often as you like.

                         

                        The official Javascript Tutorial can be found on the Adobe site: http://www.adobe.com/products/indesign/scripting/ -- click the "Scripting resources" bar, then download the Starting tutorial and the full guide. It contains lots of little snippets, just to show these kind of things.

                         

                        [note] Neither of these statements are true  . You can change the formatting of any line at all by referring to its line number (app.selection[0].parentStory.lines[1] will change the 2nd line of text), paragraph number, or even word or character. However, it's useful to "keep track" by setting attributes, inserting text, setting more attributes, insert more text, etc. And of course, you can change any paragraph style into another, even 'halfway' into a paragraph. It's just that the entire paragraph will change. Just thought you might want to know.

                        1 person found this helpful
                        • 9. Re: Insert list of link names on current page at current text insertion point?
                          [Jongware] Most Valuable Participant

                          And something I had thought of earlier but forgot to mention:

                           

                          You are not looking at "a" window. According to InDesign, you are looking at one of its 'layoutWindows' (an application wide array) -- and the active one is appropriately called 'activeWindow'. Just like you can have lots of open documents, and there is only one 'activeDocument'. The layout window gives you a view of one or more (parts of) pages; however, there is only one 'activePage' per window. It's the one highlighted in your Pages panel, and I think if you have two pages highlighted, it defaults to the right hand one (but better make sure you only have one selected!).

                           

                          Putting this all together, you can use this

                           

                          theStoriesPage = app.activeWindow.activePage;

                           

                          to directly get a pointer to the page you are viewing. It doesn't matter where the text frame holding your text insertion cursor is -- in the middle of the page, on the pasteboard, or not even visible on the screen. You don't need the intricate way of 'getting hold of a page' in the first part of the script; just this one line.

                           

                          Thought you might want to know that as well.

                          • 10. Re: Insert list of link names on current page at current text insertion point?
                            Dizz Hicks Level 1

                            Ah, you're good.

                            One last thing: colors for the text. I read on that guide that it'll take swatches or RGB values, the latter I tried, below (in bold), to failure.

                            I'd prefer using CMYK values, but where am I going wrong?

                            Thanks, again.

                             

                             

                             

                            theStoriesPage = app.selection[0].parentTextFrames[0];

                            while (1)

                            {

                            theStoriesPage = theStoriesPage.parent;

                            if (theStoriesPage.constructor.name == "Page")

                              break;

                            if (theStoriesPage.constructor.name == "Character")

                              theStoriesPage = theStoriesPage.parentTextFrames[0];

                            if (theStoriesPage.constructor.name == "Spread" || theStoriesPage.constructor.name == "MasterSpread")

                              alert ("For this script to work, the text box must be on the page itself."); exit(0);

                            }

                             

                            app.selection[0].contents = "";

                            app.selection[0].insertionPoints[-1].appliedFont = "Helvetica";

                            app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                            app.selection[0].insertionPoints[-1].pointSize = 30;

                            app.selection[0].insertionPoints[-1].fillColor = [120, 120, 120];

                            app.selection[0].contents = "LINKED IMAGE:\r";

                            app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                            app.selection[0].insertionPoints[-1].pointSize = 20;

                            for (all=0; all<theStoriesPage.allGraphics.length; all++)

                            app.selection[0].contents = (all ? "" : "")+theStoriesPage.allGraphics[all].itemLink.name+"\r";

                             

                            app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                            app.selection[0].insertionPoints[-1].pointSize = 30;

                            app.selection[0].contents = "\rSIZE:\r";

                             

                            app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                            app.selection[0].insertionPoints[-1].pointSize = 20;

                            app.selection[0].contents = app.activeDocument.documentPreferences.pageWidth

                            +"˝ × "

                            +app.activeDocument.documentPreferences.pageHeight+"˝\r";

                             

                            app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                            app.selection[0].insertionPoints[-1].pointSize = 30;

                            app.selection[0].contents = "\rBLEED:\r";

                             

                            app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                            app.selection[0].insertionPoints[-1].pointSize = 20;

                            app.selection[0].contents = app.activeDocument.documentPreferences.documentBleedTopOffset+"˝";

                            • 11. Re: Insert list of link names on current page at current text insertion point?
                              Dizz Hicks Level 1

                              Okay, I found that the files in question all have suitable swatches, so I got that running instead:

                               

                              app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=100 Y=0 K=0");

                               

                              –and replaced that top section with:

                               

                              theStoriesPage = app.activeWindow.activePage;

                               

                              Which works great.

                               

                              Now, if only I could move the text frame onto the "Printer Notes" layer at the end of this script... I saw another script you wrote to move objects up or down layers, but can't find one that fits what I need.

                               

                              Thanks for all your help. The script will save me no end of time in my work.

                              • 12. Re: Insert list of link names on current page at current text insertion point?
                                [Jongware] Most Valuable Participant

                                Oof -- saved by intercontinental time lag. As you already have found out, you can't use 'colors' directly in javascript, as it can only manipulate swatches. If you think the swatch may not exist at some time, you can always create one. First test if it's already there; if not, add it:

                                 

                                mySwatch = app.activeDocument.swatches.item("PrinterNote");

                                if (mySwatch == undefined)

                                mySwatch = app.activeDocument.colors.add({name:"PrinterNote", model:ColorModel.PROCESS, space:ColorSpace.CMYK, colorValue:[0,100,0,0]});

                                 

                                Then you can use "app.selection[0].insertionPoints[-1].fillColor = mySwatch;"

                                (The color/swatch dichotomy reveals itself here; you add a color, and use it as a swatch.)

                                 

                                Moving the frame to another layer is quite easy. As the selection point is still inside the frame, you can grab it using

                                 

                                app.selection[0].textContainers[0]

                                 

                                -- the 'textContainers' is an array of all text frames that hold the current story -- and move it to another location with the move command:

                                 

                                void move ([to: {Array of 2 Units | Spread | Page | Layer} ][, by: Array of Measurement Unit (Number or String)=any])

                                 

                                This seems to do a lot, but that's because you can move any object into any direction: to a specific position, to another spread or page or (indeed) layer, and by some relative amount. But we're only interested in the first half here -- no "by" needed:

                                 

                                app.selection[0].textContainers[0].move (app.activeDocument.layers.item("Printer Notes"));

                                 

                                (Notice you can also test the presence of the Printer Notes layer and add it if not there; see above.)

                                • 13. Re: Insert list of link names on current page at current text insertion point?
                                  Dizz Hicks Level 1

                                  Maybe it's CS3, but it doesn't like the textContainers bit, see attached.

                                   

                                  Thanks.

                                  • 14. Re: Insert list of link names on current page at current text insertion point?
                                    [Jongware] Most Valuable Participant

                                    Ow -- try 'parentTextFrames[0]' instead ..

                                    • 15. Re: Insert list of link names on current page at current text insertion point?
                                      Dizz Hicks Level 1

                                      I think of something new the script needs and every time I Google/Adobe forum/Guide PDF search the heck out of it, and every time I come up empty.

                                      Though I did find this which works well for adding missing swatches:

                                       

                                      try {

                                      app.activeDocument.colors.item("C=0 M=0 Y=0 K=60").name;

                                      }

                                      catch (myError){

                                      app.activeDocument.colors.add({name:"C=0 M=0 Y=0 K=60", model:ColorModel.process, colorValue:[0,0,0,60]});

                                      }

                                       

                                      Now my colours, and almost everything else, is working a treat. But my layers aren't: I get the following error from InDesign CS3:

                                       

                                      Error Number: 21

                                      Error String: undefined is not an object

                                      Line: 90

                                      Source:

                                       

                                      app.selection[0].parentTextFrames[0].move(app.activeDocument.layers.item("Printer Notes"));

                                       


                                      What's wrong with this bit of script? (It's the last thing in the script. What is "undefined"? Why isn't it an object?) And how do I assign a colour to a layer properly?

                                       

                                       

                                      try{

                                      app.activeDocument.layers.item("Printer Notes").name;

                                      }

                                      catch (myError){

                                      app.activeDocument.layers.add({name:"Printer Notes", printable: false, color:"Magenta"});

                                      }

                                      app.selection[0].parentTextFrames[0].move(app.activeDocument.layers.item("Printer Notes"));

                                       

                                       

                                      The layer creates itself, albeit in a default colour, but the text frame doesn't move itself there and the error pops up.

                                       

                                      Many more thanks...

                                      • 16. Re: Insert list of link names on current page at current text insertion point?
                                        [Jongware] Most Valuable Participant

                                        You get a default color because layers don't use swatch names. Besides, the property is called "layerColor". Use one of the UIColors names instead -- layerColor:UIColors.MAGENTA -- and yes, without any quotes.

                                         

                                        I'll have to leave your last error dangling for the mo'. (That is, if the space in "Printe r Notes" came from posting here! If it's like that in your script, well, it shouldn't be )

                                        A simple check if ID recognizes the layer is this one-line script:

                                         

                                        alert (app.activeDocument.layers.item("Printer Notes").name);

                                         

                                        You get an error if it's not there, the name if it does exist.

                                        • 17. Re: Insert list of link names on current page at current text insertion point?
                                          Dizz Hicks Level 1

                                          It says it's there (and now, in pretty magenta, thanks). Here's the full code...

                                           

                                           

                                           

                                          theStoriesPage = app.activeWindow.activePage;

                                           

                                          try {

                                          app.activeDocument.colors.item("C=0 M=100 Y=0 K=0").name;

                                          }

                                          catch (myError){

                                          app.activeDocument.colors.add({name:"C=0 M=100 Y=0 K=0", model:ColorModel.process, colorValue:[0,100,0,0]});}

                                           

                                          try {

                                          app.activeDocument.colors.item("C=0 M=0 Y=0 K=60").name;

                                          }

                                          catch (myError){

                                          app.activeDocument.colors.add({name:"C=0 M=0 Y=0 K=60", model:ColorModel.process, colorValue:[0,0,0,60]});

                                          }

                                           

                                          app.selection[0].contents = "";

                                          app.selection[0].insertionPoints[-1].appliedFont = "Helvetica";

                                          app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                                          app.selection[0].insertionPoints[-1].pointSize = 50;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=0 Y=0 K=60");

                                          app.selection[0].contents = "ELEMENT:\r";

                                          app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                                          app.selection[0].insertionPoints[-1].pointSize = 40;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=100 Y=0 K=0");

                                           

                                          app.selection[0].contents = app.activeDocument.name+"\r";

                                          //Clear the find/change preferences.

                                          app.findTextPreferences = NothingEnum.nothing;

                                          app.changeTextPreferences = NothingEnum.nothing;

                                          //Set the find options.

                                          app.findChangeTextOptions.caseSensitive = false;

                                          app.findChangeTextOptions.includeFootnotes = false;

                                          app.findChangeTextOptions.includeHiddenLayers = false;

                                          app.findChangeTextOptions.includeLockedLayersForFind = false;

                                          app.findChangeTextOptions.includeLockedStoriesForFind = false;

                                          app.findChangeTextOptions.includeMasterPages = false;

                                          app.findChangeTextOptions.wholeWord = false;

                                          //Search the document for the string "copy" and change it to "text".

                                          app.findTextPreferences.findWhat = "_";

                                          app.changeTextPreferences.changeTo = " ";

                                          app.selection[0].parentStory.changeText();

                                          app.findTextPreferences.findWhat = ".indd";

                                          app.changeTextPreferences.changeTo = "";

                                          app.selection[0].parentStory.changeText();

                                          //Clear the find/change preferences after the search.

                                          app.findTextPreferences = NothingEnum.nothing;

                                          app.changeTextPreferences = NothingEnum.nothing;

                                           

                                           

                                          app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                                          app.selection[0].insertionPoints[-1].pointSize = 50;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=0 Y=0 K=60");

                                          app.selection[0].contents = "\rLINKED IMAGE:\r";

                                          app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                                          app.selection[0].insertionPoints[-1].pointSize = 40;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=100 Y=0 K=0");

                                          for (all=0; all<theStoriesPage.allGraphics.length; all++)

                                          app.selection[0].contents = (all ? "" : "")+theStoriesPage.allGraphics[all].itemLink.name+"\r";

                                           

                                          app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                                          app.selection[0].insertionPoints[-1].pointSize = 50;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=0 Y=0 K=60");

                                          app.selection[0].contents = "\rSIZE:\r";

                                           

                                          app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                                          app.selection[0].insertionPoints[-1].pointSize = 40;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=100 Y=0 K=0");

                                          app.selection[0].contents = app.activeDocument.documentPreferences.pageWidth

                                          +String.fromCharCode(0x02DD)+" "

                                          +String.fromCharCode(0x00D7)+" "

                                          +app.activeDocument.documentPreferences.pageHeight+String.fromCharCode(0x02DD)+"\r";

                                           

                                          app.selection[0].insertionPoints[-1].fontStyle = "Bold";

                                          app.selection[0].insertionPoints[-1].pointSize = 50;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=0 Y=0 K=60");

                                          app.selection[0].contents = "\rBLEED:\r";

                                           

                                          app.selection[0].insertionPoints[-1].fontStyle = "Regular";

                                          app.selection[0].insertionPoints[-1].pointSize = 40;

                                          app.selection[0].insertionPoints[-1].fillColor = ("C=0 M=100 Y=0 K=0");

                                          app.selection[0].contents = app.activeDocument.documentPreferences.documentBleedTopOffset+String.fromCharCode(0x02DD) ;

                                           

                                          try{

                                          app.activeDocument.layers.item("Printer Notes").name;

                                          }

                                          catch (myError){

                                          app.activeDocument.layers.add({name:"Printer Notes", printable: false, layerColor:UIColors.MAGENTA});

                                          }

                                          alert (app.activeDocument.layers.item("Printer Notes").name);

                                          app.selection[0].parentTextFrames[0].move(app.activeDocument.layers.item("Printer Notes"));

                                          • 18. Re: Insert list of link names on current page at current text insertion point?
                                            Dizz Hicks Level 1

                                            And that space isn't really there. Honest.

                                            • 19. Re: Insert list of link names on current page at current text insertion point?
                                              jay fresno Level 1

                                              Dizz,

                                              I appreciate that you posted the full text of your script. Often, because I'm not a scripter, I can't follow the threads when a script is posted piecemeal. This script would be useful for me, but when I try to use it, nothing happens. I have a page with linked graphics, and my cursor is inside an empty text frame when I run the script. Any idea why nothing happens?

                                              • 20. Re: Insert list of link names on current page at current text insertion point?
                                                [Jongware] Most Valuable Participant

                                                "D'oh!" Finally figured it out.

                                                 

                                                You are working from your current selection. Apparently, that's already an insertion point -- and fortunately, insertion points also have InsertionPoints, to insert even more text inbetween them. The parent of an insertion point is a story. Sounds logically so far. Now the parent of the Story is ... a Document. Crash & burn!

                                                I think this is because you can have an unplaced story, loaded in your cursor -- like a newly created Table of contents. Unfortunately, you cannot use this for any smart tricks like 'creating the text first, and only then place it somewhere'.

                                                 

                                                So I was wrong the entire time, when I refered to parents and parentTextFrames -- these are 'the frame that some text is in', looking up. When looking down from a story, you can have lots of frames for that single story, and that, finally!, is called its 'textContainer':

                                                 

                                                app.selection[0].parent.textContainers[0].move(app.activeDocument.layers.item("Printer Notes"));

                                                 

                                                THIS finally works.

                                                 

                                                ... Honestly. I tried it.

                                                • 21. Re: Insert list of link names on current page at current text insertion point?
                                                  [Jongware] Most Valuable Participant

                                                  Jay, copying the script out of the formatted web page is nigh on useless. There were a couple of bad spaces in there that ...

                                                  Wait, nothing happens? At the very least, you should get an error message!

                                                  Perhaps some badly () written script switched off your user interaction level. Switch it back on with this one-line script:

                                                   

                                                  app.scriptPreferences.userInteractionLevels = UserInteractionLevels.INTERACT_WITH_ALL;

                                                   

                                                  For your convenience, I'm attaching the latest full, willing & able version of Dizz' script. I tagged it a 'text file', which is only to fool the forum software into accepting it. Remove the '.txt' and it oughta work.

                                                  • 22. Re: Insert list of link names on current page at current text insertion point?
                                                    Dizz Hicks Level 1

                                                    Here's that script attached again, only with a thing that switches the units to inches at the beginning then back to whatever it was initially at the end. That's only because I can't work out how to properly script something like:

                                                     

                                                     

                                                    app.selection[0].contents =.............

                                                     

                                                    +app.activeDocument.viewPreferences.horizontalMeasurementUnits;

                                                    to return the current units, instead of my

                                                     

                                                     

                                                    String.fromCharCode(0x02DD)

                                                     

                                                    which returns the double prime, the accurate symbol for inches (once a typographer, always a typographer).

                                                     

                                                    It's no big deal to us, because being in the USA, with its 19th-century measurement system, we always have to work in inches.

                                                     

                                                     

                                                    Jay, If you want to change that to millimeters, in the code change that first inchesDecimal to millimeters, ditto centimeters, and switch out the String.fromCharCode(0x02DD) for  "mm" or  "cm"

                                                     

                                                     

                                                     

                                                    Thank you, Jongware. I hope Adobe knows what good you're doing.

                                                    • 23. Re: Insert list of link names on current page at current text insertion point?
                                                      [Jongware] Most Valuable Participant

                                                      Well, Dizz, they didn't send the lawyers after me when I created a better Help, so I guess they approve of it (silently).

                                                       

                                                      I've just a really really really tiny nit-pick to add:

                                                       

                                                      String.fromCharCode(0x02DD)

                                                       

                                                      which returns the double prime, the accurate symbol for inches (once a typographer, always a typographer).

                                                       

                                                      Ehm. That returns a Hungarian, or Double acute. The actual double prime seems not to be present in standard Helvetica (I suppose they intend you to use the definitely not typographically correct double straight quote "). A real double prime can be found in Symbol (U+2033), or, if you have it on your system, in Arial Unicode MS (I know, mixing Helvetica with Arial; but, really, it's just for the prime!) or in Lucida Sans Unicode.

                                                      • 24. Re: Insert list of link names on current page at current text insertion point?
                                                        Dizz Hicks Level 1

                                                        You know I could press that “Report Abuse” button. That ““““Hungarian”””” (sorry, my bad, to be honest primes are fairly new to me) is better than a close double quote, which is what they were using here... anyway, I'll get me coat.

                                                         

                                                        At least my times symbol is accurate, better than an "x".

                                                         

                                                        • 25. Re: Insert list of link names on current page at current text insertion point?
                                                          jay fresno Level 1

                                                          Jongware and Dizz,

                                                          Many thanks to you both -- script is now working.