Launching Programs from the TOC and Index

This exercise shows how to launch a program from the Table of Contents using a hidden Shortcut control. This works much like the WinHelp topic entry macro, except you must use JavaScript to perform the action.

Create a topic and add a Shortcut

In the first part of this exercise you create blank topic and place a hidden Shortcut control on the topic.  You then modify the topic in TrueCode so it activates a program when the topic is launched from either the TOC or Index of an HTML Help system.

  1. Create a new topic called Launch Notepad.

  2. Delete all the text from the screen.

  3. Choose Insert: HTML Help: Shortcut.

  4. Select Hidden (for scripts) and click Next.

  5. In Program to run when shortcut is activated type: Notepad.exe.

  6. (optional) - In Window class of program window, type: notepad.

  7. Click Next and Finish.

  8. On the topic just created, click TrueCode.

  9. Locate the <BODY> tag.

  10. Add the following parameters:
    <body onLoad=Shortcut.Click();history.back(1)>


    When the topic loads, it activates the hidden shortcut script, which launches Notepad, then takes you back to the previous topic.
     

  11. Click Save.

Create a TOC link

The link created in this step and the next launches the topic created in the previous step.

  1. Click the TOC tab.

  2. Create a link to the topic named Launch Notepad.

Create an Index link

  1. Click the Index tab.

  2. Create a keyword named Launch Notepad and associate the topic to the keyword.

  3. Compile and Run.
    When the topic is activated, onLoad=Shortcut.Click() launches Notepad.exe, and history.back(1) returns you to the prior topic.

Next, Secondary Windows in HTML Help