Navigation:  Basic Working Procedures > Links, Anchors, Macros, Scripts and HTML >

Inserting script and Winhelp macro links

Print this Topic Previous pageReturn to chapter overviewNext page
Expand All   Collapse All

In this topic:

This function inserts a piece of JavaScript code or a Winhelp Note that Windows Vista does not support Winhelp. If you want to be compatible with Vista you must transition to a different help format. macro that is executed when the user clicks on the link in your help file. Note that scripts and macros are not supported in all output formats – see below for details.

See Scripts, HTML and Macros in the Reference section for some more background information on scripts and macros and how they are implemented and handled.

How to insert a script or macro link:

1.Select text in your document if you want to use it as the link. You don't have to do this – you can enter a completely new caption in the Insert Hyperlink dialog box if you want.
2.Open the Insert Hyperlink dialog box. There are several different ways to do this:
Press Ctrl+L
Select the Insert Hyperlink button in the Toolbar
Select Hyperlink... in the Insert menu
3.Select the Script / Macro option at the top of the dialog.

4.Edit the Caption: if necessary and select the link Style:
5.Select HTML JavaScript or Winhelp Macro and enter your script or macro in the editing field.
See The Hyperlink dialog for full details on the settings in the dialog.
See Scripts, HTML and Macros in the Reference section for full details on how scripts and macros are implemented and handled.

Macro implementation:

Macros can be typed and used just as you would use them manually in Winhelp Note that Windows Vista does not support Winhelp. If you want to be compatible with Vista you must transition to a different help format.. Note that Winhelp macros only work in Winhelp. If you are also generating other formats you need to create alternatives for the other formats using conditional output.

See the help included with Microsoft Help Workshop (the Winhelp compiler package) for documentation of the macro functions available in Winhelp.

Translation of Winhelp macros in HTML Help:

The following four standard Winhelp Note that Windows Vista does not support Winhelp. If you want to be compatible with Vista you must transition to a different help format. macros are automatically translated to their HTML equivalents when you compile to HTML Help. This can be convenient as the syntax of these Winhelp macros is simpler and easier to enter:

ALink()

KLink()

TCard()

Close()

Note that only keywords are supported as arguments in the ALink and KLink macros when they are used in HTML Help. All other arguments are ignored.
If you have upgraded from Help & Manual 3 you may be wondering what has happened to the ExecFile() Winhelp macro, which used to be translated in HTML Help. This is no longer necessary because you can use file links instead, which produce the same result much more efficiently.

Script implementation:

Help & Manual creates script links by inserting the code you type between <a href=" and ">. For example, if you type:

javascript:alert('Hello World!');

The resulting link created in your output will be:

<A HREF="javascript:alert('Hello World!');">

This is just a simple example of course, you can place as much code in the script as you want.

If you are familiar with JavaScript and HTML you can use this knowledge to create quite complex scripts! You just have to remember that everything you write is inserted between <a href=" and ">. See Scripts, HTML and Macros in the Reference section for more details.

Macro/script link compatibility in output formats:

The functionality of script and macro links in the individual output formats is as follows:

Winhelp:

All Winhelp macros, no scripts. Paths will generally work.

HTML Help:

JavaScript is broadly supported in CHMs. See the MS HTML Help Workshop documentation for details. Four standard Winhelp macros (see above) are translated to their HTML Help equivalents. Do not use paths.

Visual Studio Help:

Same as for HTML Help.

Browser-based Help:

Scripts are supported but support depends to a great extent on the user's browser, so use the same caution as when using scripting in any HTML pages.

eBooks:

Script and macro links are not supported.

Adobe PDF:

Script and macro links are not supported.

Word RTF:

Script and macro links are not supported.

See also:

Scripts, HTML and Macros

Inserting plain HTML code

Using HTML templates

Browser-based Help (Project Properties)

 


Page url: http://www.helpandmanual.com/help/index.html?hm_working_links_macros.htm