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.
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.
Create a new topic called Launch Notepad.
Delete all the text from the screen.
Choose Insert: HTML Help: Shortcut.
Select Hidden (for scripts) and click Next.
In Program to run when shortcut is activated type: Notepad.exe.
(optional) - In Window class of program window, type: notepad.
Click Next and Finish.
On the topic just created, click TrueCode.
Locate the <BODY> tag.
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.
Click Save.
The link created in this step and the next launches the topic created in the previous step.
Click the TOC tab.
Create a link to the topic named Launch Notepad.
Click the Index tab.
Create a keyword named Launch Notepad and associate the topic to the keyword.
Compile
and Run.
When the topic is activated, onLoad=Shortcut.Click()
launches Notepad.exe, and history.back(1) returns
you to the prior topic.