Professional Web Applications Themes

Page References - Adobe Indesign Windows

Hi Teus, I ran the script and got this error. If this means that I'm not setting my hyperlinks correctly, is there somewhere that I could go to read more about setting hyperlinks? Thanks very much. Mary JavaScript Error! Error Number: 2 Error String: hyper is undfined Line: 4 Source: if (hyper.name.substring(0,1) =='.'{continue}...

Sponsored Links
  1. #1

    Default Re: Page References

    Hi Teus,
    I ran the script and got this error. If this means that I'm not setting my hyperlinks correctly, is there somewhere that I could go to read more about setting hyperlinks?
    Thanks very much.
    Mary

    JavaScript Error!

    Error Number: 2
    Error String: hyper is undfined
    Line: 4
    Source: if (hyper.name.substring(0,1) =='.'{continue}
    Sponsored Links
    Mary_Alipio@adobeforums.com Guest

  2. #2

    Default Re: Page References

    Mary,

    I made a very stupid mistake: I forgot to define hyper!

    The start should be


    for (i = 0; i < app.activeDoent.hyperlinks.length; i++){

    hyper = app.activeDoent.hyperlinks[i];
    // leave ID's own internal markers alone
    if (hyper.name.substring(0, 1) == '.'){continue}
    .....


    Teus
    Teus_de_Jong@adobeforums.com Guest

  3. #3

    Default Re: Page References

    Ok- I replaced the begining of the script. Thanks for that. It looks like the script is running (I get an hour glass, but the XX does not update with the correct page number. I must not be following the directions you gave correctly. I have some questions about reference creation you refer to. Thanks.

    Can you clarify what kind of reference you mean here. It's from your previous message, #6.

    'b'Place a reference somewhere:

    For the New Page reference, is that something I create via the Index Pallette?

    'b'place a reference somewhere:in the text where you want to refer to choose New Page Reference from the Hyperlink dialog.

    Is this cross refernce you refer to also made in the Index palette?

    'b'Now on the place you want the cross reference to crossrefdest1 to appear, type e.g. 'xx'. Make sure you choose the complete text (in this example both x's).
    Mary_Alipio@adobeforums.com Guest

  4. #4

    Default Re: Page References

    I tried then steps below and got this message.

    Error Number 55
    Error String: Object does not support the property or method "contents"
    Line: 27
    Source: hyper.source.contents = s;

    I used this from my report:
    .......These are explained in the section “Highlights of changes since February FFR” on page XX.

    And this refernce which is on page 44:

    .......Highlights of changes since February 2005 FFR

    And followed these steps.
    1. Highlighted XX with my cursor.
    2. Went to hyperlink palette and created a > New Hyperlink Destination. Named it 'crossrefdest1'
    3. went to page 44 and highlighted 'Highlights of changes since February 2005 FFR' with my cursor.
    4. Went to Hyperlink Palette, created > New Hyperlink. Named it 'crossref1'. Selected Text Anchor. Indicated 'crossrefdest1'
    5. Ran the script
    Mary_Alipio@adobeforums.com Guest

  5. #5

    Default Re: Page References

    Mary,

    You should do it exactly reversed. In your example, place the cursor at what is at point 3: 'Highlights of changes since February 2005 FFR' and create here a hyperlink destination, crossrefdest1.

    Next select 'XX' from “Highlights of changes since February FFR” on page XX and create a hyperlink crossref1 with as destination crossrefdest1.

    Then it should work.

    Explanation: the sourcetext of the hyperlink is XX, which is in the script updated to the pagename of the hyperlink destination.

    Teus
    Teus_de_Jong@adobeforums.com Guest

  6. #6

    Default Re: Page References

    The script fragments have become too far apart. I think there may be a bug in also. So here is the script again:


    for (i = 0; i < app.activeDoent.hyperlinks.length; i++){

    hyper = app.activeDoent.hyperlinks[i];
    // leave ID's own internal markers alone
    if (hyper.name.substring(0, 1) == '.'){continue}
    if (hyper.destination.constructor.name == 'HyperlinkTextDestination'){

    try {

    if(app.version == 3){

    myFrame = hyper.destination.destinationText.parentTextFrame;
    }
    else {

    myFrame = hyper.destination.destinationText.parentTextFrames[0];
    }
    pag = myFrame.parent;
    while (pag.constructor.name != 'Page'){

    pag = pag.parent;
    }
    s = pag.name;
    }
    catch (e) {

    alert('Could not catch page');
    continue;
    }
    }
    else {

    s = hyper.destination.destinationPage.Name;
    }
    hyper.source.sourceText.contents = s;
    }


    If you want, I can give you a link to a zipped doent in which this is used.

    Teus
    Teus_de_Jong@adobeforums.com Guest

  7. #7

    Default Re: Page References

    I have placed the script and a tutorial (hands on how to do it) on my home page. You can go there by clicking on my name, or directly download it with the following link:

    crossrefs.zip <http://www.teusdejong.nl/indesign/crossrefs.zip>

    Teus
    Teus_de_Jong@adobeforums.com Guest

  8. #8

    Default Re: Page References

    Teus,

    Thanks for posting that whole package! You might want to post it at Adobe Studio, too, since it solves a real need. I looked the tutorial over (very) quickly and it looks to me like the very first lesson has already been run before the file was saved -- I see a page 1 instead of page xx in what I think is the relevant spot on page 3.

    Peter
    Peter_Spier@adobeforums.com Guest

  9. #9

    Default Re: Page References

    Peter,

    I looked the tutorial over (very) quickly and it looks to me like the
    very first lesson has already been run before the file was saved -- I
    see a page 1 instead of page xx in what I think is the relevant spot on
    page 3.




    Thanks for checing this! I have updated the package.

    I'll think about Adobe Studio. Ken Grace suggested the same for a script that applies an object style to xml elements with a certain tag. For both are on my home page.

    Teus
    Teus_de_Jong@adobeforums.com Guest

  10. #10

    Default Re: Page References

    Teus,

    I saw Ken's suggestion shortly after posting mine. I think it's great that you post these on your website for everyone, and I'm sure you will get many hits. On the other hand, I can't tell you how many people I know who never think to read these forums (their loss!) and consequently don't even know you exist (their loss again!). I think Adobe studio has a bigger audience and would be a very appropriate place for an additional posting. Who knows, you could end up famous.

    Peter
    Peter_Spier@adobeforums.com Guest

  11. #11

    Default Re: Page References

    Hi Teus,
    I am very happy to report that I was able to create my first auto-page update - thanks to you! Your tutorial was very helpful. Thank you for being so generous with your talents.

    Regards,
    Mary
    Mary_Alipio@adobeforums.com Guest

  12. #12

    Default Re: Page References

    :-)

    Teus
    Teus_de_Jong@adobeforums.com Guest

Similar Threads

  1. Web References
    By sendhil in forum ASP.NET Web Services
    Replies: 5
    Last Post: December 11th, 08:34 PM
  2. Getting references
    By John in forum Ruby
    Replies: 2
    Last Post: November 3rd, 07:35 AM
  3. PHP's References
    By in forum PHP Development
    Replies: 3
    Last Post: September 4th, 08:21 AM
  4. [PHP-DEV] References
    By LingWitt@insightbb.com in forum PHP Development
    Replies: 3
    Last Post: August 30th, 02:35 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139