Hyperlink to hyperlinkTextDestination in external document

I have an InDesign book (.indb) with one document for each chapter, plus one document for the table of contents.  I'm trying to automate the process of making a hyperlink from each item in the TOC to a hyperlinkTextDestination I've already added to each of the other documents.  This way, when I Export for Digital Editions, I have copy of my TOC with hyperlinks to each chapter.
My TOC is just a simple page with a textFrame, with each link on its own line, like this:
Chapter 1
Chapter 2
Chapter 3
Can anyone please describe how to do this in JavaScript?  Thanks in advance for any help.

I was finally able to figure out the problem, and since I haven't been able to find anything on this specific topic elsewhere, I'll post it here for posterity.
The main problem was that my destination document was closed when I tried to create the hyperlink.  I stored the hyperlinkTextDestinations for each doc into an array so I could call them later, and then closed the document so the script could do other stuff.  Anyway, here are the code snippets pertinent to hyperlinking to external hyperlinkTextDestinations:
var mydocs = bookPath.getFiles('*.indd');  // Folder containing each chapter's document
var hyperlinkDestinations = new Array;
for (i=0; i<mydocs.length; i++){
  var thisDoc = app.open(mydocs[i]);
  // Add hyperlink destinations
  var newDestination = thisDoc.hyperlinkTextDestinations.add(thisDoc.textFrames[0].insertionPoints[0]);
  hyperlinkDestinations.push(newDestination);
  thisDoc.close();
Then in my TOC document:
var tocdoc = app.activeDocument;
var toc = tocdoc.textFrames[0].paragraphs;
for (i=0; i<toc.length; i++) {
  // My TOC list is in the same order as my files are...
  var myHyperlinkTextSource = tocdoc.hyperlinkTextSources.add(toc[i]);
  var tempDoc = app.open(mydocs[i]); // Make sure doc is open before referencing hyperlinkTextDestination
  var myHyperlink = tocdoc.hyperlinks.add(myHyperlinkTextSource, hyperlinkDestinations[i]);
  tempDoc.close();
This isn't my exact code (I just copied out bits and pieces), so I haven't tested it.  If anyone knows a better way of doing this, feel free to chime in.
I've taken a pretty deep dive into InDesign scripting and this forum has been incredibly helpful, so I hope this pays it forward, at least a little.  Thanks!

Similar Messages

  • How can I hyperlink from FM to an external document and make the links work in PDF-XChange Viewer?

    A couple of months ago some of you kindly taught me how to insert links to an external document in FrameMaker. The syntax that made all the difference, was the following:
    message openfile "H:/folder name/to/your/file.ext"
    I converted my FrameMaker file to PDF format using Acrobat Distiller, and everything worked like a charm when the users opened the resulting PDF document in Acrobat Reader.
    Much to my frustration, someone has now decided that the organisation should use PDF-XChange Viewer instead of Acrobat Reader, and my links don't work anymore... Nothing happens when you click on them. (This only applies to links to external documents. Links to e.g. websites work nicely.)
    Has anybody got any idea what I could do to make the links work in PDF-Xchange Viewer as well? Or am I trying to do the impossible now?
    Best regards
    Jorunn

    Jorunn H wrote:
    A couple of months ago some of you kindly taught me how to insert links to an external document in FrameMaker. The syntax that made all the difference, was the following:
    message openfile "H:/folder name/to/your/file.ext"
    I converted my FrameMaker file to PDF format using Acrobat Distiller, and everything worked like a charm when the users opened the resulting PDF document in Acrobat Reader.
    Much to my frustration, someone has now decided that the organisation should use PDF-XChange Viewer instead of Acrobat Reader, and my links don't work anymore... Nothing happens when you click on them. (This only applies to links to external documents. Links to e.g. websites work nicely.)
    Has anybody got any idea what I could do to make the links work in PDF-Xchange Viewer as well? Or am I trying to do the impossible now?
    Best regards
    Jorunn
    Have you tried contacting the PDF-Xchange company's technical support? What results?
    Regards,
    Peter Gold
    KnowHow ProServices

  • I have set hyperlinks within my ibook author document, they work perfectly until i export and view on the ipad, when only one or none work, (hyperlinks to website not working at all) what am i doing wrong?

    I have set hyperlinks within my ibook author document, they work perfectly until i export and view on the ipad, when only one or none work, (hyperlinks to website not working at all) what am i doing wrong?

    An external hyperlink should handoff to Safari and leave iBooks.
    If that's not happening, perhaps there is something misconfigured on your iPad? Have you manually confirmed those links work in Safari on your iPad?

  • Hyperlinks from other placed indd documents or pdfs getting lost after export to PDF

    after upgrade vom CS 5.5 to CS 6: hyperlinks from other placed indd documents or pdfs getting lost after export to PDF
    I tried all options for the as well known and working export options

    after upgrade vom CS 5.5 to CS 6: hyperlinks from other placed indd documents or pdfs getting lost after export to PDF
    I tried all options for the as well known and working export options

  • How to link to and open external document with Mac Dreamweaver

    I'm evaluating Dreamweaver on the Mac. I know how to link to
    an external document, such as a Word or Excel document. However, I
    would like for the file to automatically open when the link is
    clicked, rather than taking me to a directory window (where I then
    have to double-click the file icon). Another option would be to
    easily import data from a Word or Excel document, but the Help
    indicates that's only possible when using Dreamweaver on Windows.
    Thanks for any guidance you can provide.

    What you need to do is this:
    1.) back up all your data from your iPod
    2.) reformat it on the Windows machine.
    You'll then be able to use your iPod on both Windows and Mac:) If you need more help, let me know!

  • How to attach external document in custom developed Web Dynpro Screen

    Hello,
    We have requirements to develop a custom portal screen using Webdynpro and should provide option to usee to attach external documents like WORD, EXCEL, TEXT, PDF and then save.
    In Change/Display mode user should also get option to view this attached document.
    Would like to know the solution in case any of you  have worked in this scenario.
    Thanks
    Sunil

    Hi,
    Refer
    1. Navigate through km using webdynpro
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f02b492c-7d76-2a10-86aa-e11e8388fde8]
    2. Upload files in km using webdynpro
    [https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/a099a3bd-17ef-2b10-e6ac-9c1ea42af0e9]
    Also this sample
    [https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/202a850a-58e0-2910-eeb3-bfc3e081257f]
    Regards
    Baby
    Edited by: Baby on Mar 18, 2009 8:01 AM

  • Create External document (URL) in SAP Personas

    Hi Smart People!
    To save some steps and incorporate a scanner I am working on creating buttons to "Attach Documents" in different areas such as MM03, FB03, and a few others where we have to keep a scanned in document attached to certain other Materials or Payables and such. All docs are scanned in and saved online and then we use the "create external document (url) menu option to link it where it is needed in SAP.
    In one place it works just fine and in the others it is not working at all and custom button or even just following the already existing menu options it keeps giving me this error. I tried search on the SCN and Google and no such luck on this error. Anyone have any ideas? See pic below and also the text below is the separated error so you can see what it actually says.
    [Unknown] ses[0]/wnd[0]/usrUSRAREA/ctlcntITS/itsdoc
    Thank you for any help you can give!

    That screen shot is for the Silverlight browser plugin.
    You can check your Personas version and patch level in System -> Status. Clicking on the magnifying glass in the SAP System Data box will list all the components of the ERP system. It will tell you what Personas version and SP is installed.
    Something like this:
    The above means Personas 2.0 SP2.
    If you indeed happen to have Personas 2.0 with no support package (so SP level says 0000), then the first thing I'd recommend is to bring the system to the latest level, which would be like in the screen shot, and then trying again. There is a good chance the problem will be resolved.
    If your system is completely up-to-date and it still gives you trouble, then create an OSS incident.

  • A hyperlink click to a pdf document in a website does not open a pdf document instead presents a blank page "searching for bookmarks"

    a hyperlink click to a pdf document in a website does not open a pdf document instead presents a blank page "searching for bookmarks"

    Check the settings as shown in the [[opening PDF files within Firefox]] article.

  • Purchase Order Modification: External Document Number already assigned

    Hello,
    We're running Extended Classic Scenario in a SRM 4.0 implementation.
    The problem is the following: When the user modifies a purchase order (this purchase order is already replicated to the backend), sometimes (not always), the next error occurs:
    "Purchase Order XXXXXXXXXX: PO header data still faulty "
    "Purchase Order XXXXXXXXXX: External document number XXXXXXXXX already    assigned"
    The system does not provide additional info (RZ20 give us the same message, no ST22 dumps...
    We think it could be some kind of error in the standard BAPI BAPI_PO_CHANGE.
    We've revised the SAP OSS but didn´t find anything....
    Some idea?
    Regards and Thanks in advance!!!

    Hi
    <u>Any other rrors / dumps noticved in system using RZ20 and ST22 transactions ?</u>
    <b>Have you seen this helpful pointers and link ?</b>
    <u>The related SAP OSS notes are as under :</u>
    <b>"Purchase Order item 00010 still contains faulty account assignment items"</b>
    <b>Note 1000184 - Account assignment error when document transfer to back end</b>
    Note 966323 - Service Item: Not able to create PO in ERP backend
    "Purchase Order item 00010 still contains faulty account assignment items"
    Re: How to create a PO in R/3 from a local Bid Invitation in classic scenario ?
    Re: From local Bid invitation PO is not generated in backend
    <b>Do let me know.</b>
    Regards
    - Atul

  • Acrobat X external document linking problem

    Hello,
    I have been using Acrobat 6 standard for our user manuals for years and have recently started using Acrobat X.
    It seems that the external document linking has changed though.  I used to put all of our 3rd party literature (PDFs) in a separate folder (to keep it clean and neat) under our main manual PDF.  I would link to all those documents inside our user manual PDF.  Then when I later burned the PDF and the 3rd party literature to a CD, as long as I maintained the folder heirarchy, everything worked just fine.
    Under Acrobat X though this doesn't seem to be the case.  If I just burn it to a CD, then the all of the external links are broken.  I have been able to do this by adding Desinations names to the 3rd part literature but this is a lot more work and I don't want to modify all of the 3rd party docs.  In addition, some of them are read only and you cannot edit them.
    Does anyone know how to link to external documents in Acrobat X and then move them to a new location while maintaining the link without editing the external documents (some are read only).
    Thank you for any help you can give me.

    The Javascript code populates a field on the form and the If Then statement sets this value based on  the amount in another field.  I have changed all of the values in the If Then statement but the button is still using the old values.
    I have tried this on three different computers and it will not pick up the new values. 

  • Add hyperlink or button to open document in client application

    Good day.
    I have SharePoint 2013 and Office Web Apps 2013 integrated with it.
    I configured the default behavior when clicking on a document in a document library to open it in web app. 
    And I want additionally to have column in this library with hyperlink or button to open document in client application.
    I can click on menu near document name with WAC preview and then click "change" button. But in this case I make 2 clicks. So I want to have this  "change" button as a column in the list of document library.
    How can I do it?

    Hi, Daniel.
    I successfully created rich
    text type column - richtextcolumn.
    Then I created workflow associated with documents library and added action to set field in current element
    - it sets richtextcolumn with value you wrote - "<a class="ms-listlink ms-draggable"
    onclick="return DispEx(this,event,'TRUE','FALSE','FALSE','SharePoint.OpenDocuments.3','1','SharePoint.OpenDocuments','','','','1','0','0','0x7fffffffffffffff')" href="[%Current
    Item: Server Relative URL%]" DragId="7">test</a> .".
    I configured this workflow to run on element creating and editing.
    Then I upload a document and see link to this document appearing in richtextcolumn.
    But when I click this link it just download document and then open it in client application. So if I change something in this document and try to save it, it will be saved in my local download folder and not sharepoint.

  • Tnx. IW22 Change PM Notification -  Create external document (URL) posting

    Hi:
    I am in transaction IW22 i.e. Change PM Notification.  There is a 'Services for object' drop down which appears below the enter tick.  This appears in online but not in BDC.  I have tried it through the transaction SHDB i.e. Transaction Recorder also herein the 'Services for object' does not appear.  I need to post entries through 'Create external document (URL)' through the 'Services for object' drop down using BDC / BAPI / etc.
    Please advice.
    NB.

    Hi NB,
    We have similar issue for QM notification and I have used function "SO_OBJECT_INSERT".
    I am enclosing my code may be useful for you:
    FORM CREATE-URL-ATTACHMENT.
      CALL FUNCTION 'SO_FOLDER_ROOT_ID_GET'
        EXPORTING
          REGION    = 'B'
        IMPORTING
          FOLDER_ID = FOLDER_ID
        EXCEPTIONS
          OTHERS    = 1.
      CLEAR: LS_OBJCONT, LT_OBJCONT, LT_OBJHEAD.
      REFRESH: LT_OBJCONT, LT_OBJHEAD.
      CONCATENATE '&KEY&' H-URL INTO LS_OBJCONT.
      APPEND LS_OBJCONT TO LT_OBJCONT.
      CLEAR: L_OBJ_DATA.
      L_OBJ_DATA-OBJSNS = 'O'.
      L_OBJ_DATA-OBJLA  = SY-LANGU.
      L_OBJ_DATA-OBJDES = 'NOTES URL'.
      CALL FUNCTION 'SO_OBJECT_INSERT'
        EXPORTING
          FOLDER_ID             = FOLDER_ID
          OBJECT_TYPE           = 'URL'
          OBJECT_HD_CHANGE      = L_OBJ_DATA
        IMPORTING
          OBJECT_ID             = L_OBJ_ID
        TABLES
          OBJHEAD               = LT_OBJHEAD
          OBJCONT               = LT_OBJCONT
        EXCEPTIONS
          ACTIVE_USER_NOT_EXIST = 35
          FOLDER_NOT_EXIST      = 6
          OBJECT_TYPE_NOT_EXIST = 17
          OWNER_NOT_EXIST       = 22
          PARAMETER_ERROR       = 23
          OTHERS                = 1000.
      CLEAR: IS_OBJECT.
      IS_OBJECT-OBJKEY = WQMNUM.
      IS_OBJECT-OBJTYPE = 'BUS2078'.
      CLEAR: REL_DOC.
      CONCATENATE FOLDER_ID L_OBJ_ID INTO REL_DOC-OBJKEY.
      REL_DOC-OBJTYPE = 'MESSAGE'.
      CALL FUNCTION 'BINARY_RELATION_CREATE'
        EXPORTING
          OBJ_ROLEA    = IS_OBJECT
          OBJ_ROLEB    = REL_DOC
          RELATIONTYPE = 'URL'
        EXCEPTIONS
          OTHERS       = 1.
      IF SY-SUBRC EQ 0.
        COMMIT WORK.
      ELSE.
        T_MESSAGE = 'Notification Attachment Add Failed'.
        APPEND T_MESSAGE.
        CLEAR: T_MESSAGE.
        T_MESSAGE = 'Reference:'.
        T_MESSAGE+11(20) = H-REF.
        APPEND T_MESSAGE.
        CLEAR: T_MESSAGE.
        T_MESSAGE = 'Notification:'.
        T_MESSAGE+14(12) = WQMNUM.
        APPEND T_MESSAGE.
        CLEAR: T_MESSAGE.
        T_MESSAGE = 'URL:'.
        T_MESSAGE+5(72) = H-URL.
        APPEND T_MESSAGE.
        PERFORM SEND-EMAIL.
      ENDIF.
    ENDFORM.                    "create-url-attachment
    Hope this may help you.
    Please reward all the useful answers.
    Regards,
    Lanka

  • MM03/MM02 Need to create external document URL

    Hi All,
        We are having a requirement to create web link for materials using transactions MM03 or MM02.
        The exact path for this is as follows:
        Go to MM03/MM02 -> Enter material ->Basic data view -> Systems Menu -> Services for object -> Create external document URL.Here we need to enter the title and URL.
        The other path is clicking on the services for objects button that comes on the title bar and create the same.
        Is there any BAPI that can be used to achieve this.
    Reward points assured.
    Thanks and regards,
    Nilesh.

    Hi Nilesh,
        can you try 
    Using this function module:
      CALL FUNCTION 'GUI_RUN'
      EXPORTING
      command ='IEXPLORE.EXE'
      PARAMETER ='WWW.YAHOOMAIL.COM'.
    CD =
    IMPORTING
    RETURNCODE =
    in the appr place of coding
    <u>Reward pts if found usefull :)</u>
    Regards
    Sathish

  • FM to create external document(URL)   FBL1n transaction

    Hi!
    I'm trying to create a URL link in FBL1n but I'm not been able to do it.
    I checked this link[ FM to create external document(URL)|FM to create external document(URL)]
    but I'm not getting the URL in the link list.
    I can create the link manually as Vimal kumar  did, but in transaction FBL1n.
    My code is like this (I think one of the parameters is wrong.)
    data: it_BAPIPROPER type BAPIPROPER occurs 0,
          wa_BAPIPROPER like BAPIPROPER.
    DATA: WA_logical_system LIKE TBDLS-LOGSYS.
    CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
    IMPORTING
       OWN_LOGICAL_SYSTEM         = WA_logical_system
    EXCEPTIONS
       OWN_LOGICAL_SYSTEM_NOT_DEFINED       = 1
       OTHERS                               = 2.
    wa_bapiproper-prop_name = 'DESCRIPTION'.
    wa_bapiproper-prop_value = 'Test'.
    APPEND wa_bapiproper TO it_bapiproper.
    CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CRE_O_URL'
    EXPORTING
    LOGICAL_SYSTEM        = WA_logical_system
    classname = 'BSEG'
    classtype = 'BO'
    object_key ='10001900000000210001'
    url = 'http://metcold/ss2000/plainlinkurl.asp?dbid=08&k=Supplier_No,Invoice_No&v=22549,029214758&username=guest&password=guest.url'
    mimetype = 'TEXT/PLAIN'
    TABLES
    properties = it_bapiproper
    commit WORK.
    this is been execute with sy-subrc eq 0.
    Any idea?
    Thanks.

    Hi
    I tried attach an URL to document line, but without results. If I tried add URL to document header, all works perfectly. Maybe its not possible to add url-s into document lines...

  • FM to create external document(URL)

    Hi All,
    I need to create external document(URL) for equipment and functional location. Manually it is done by clicking a button (called Services for Object) which appears in the left upper corner (on the left side of the transaction heading) and then selecting option (Create External Document URL). Infact this button is availaible in many transactions.
    I need FM/BAPI using which i can create external document(URL) to equipment and functional location programmaticaly.
    Regards,
    Vimal

    Hi Viquar Iqbal,
    Thanks for ur help. It worked.
    The working code (For others reference)
    wa_BAPIPROPER-PROP_NAME = 'DESCRIPTION'.
    wa_BAPIPROPER-PROP_VALUE = 'Test'.
    APPEND wa_BAPIPROPER to it_BAPIPROPER.
    CALL FUNCTION 'BDS_BUSINESSDOCUMENT_CRE_O_URL'
      EXPORTING
        classname             = 'EQUI'
        classtype             = 'BO'
       OBJECT_KEY            ='000000000020000038'
        url                   = 'http://sparsh/V1/'
        mimetype              = 'TEXT/PLAIN'
    TABLES
      PROPERTIES            = it_BAPIPROPER
    Regards,
    Vimal
    Edited by: Vimal  kumar on Feb 18, 2009 2:59 PM

Maybe you are looking for