Return to Tutorials

Using the Shortcut Control to Open a 
.doc, .xls, .mdb, .ppt, .pdf 
or other kinds of files from a CHM

Any file extension that is associated with a program on the user's machine is fairly easy to bring up in its application with the Shortcut Control.  

In RoboHTML, with the cursor positioned where you want the link, click Insert and select Shortcut. Then, when the Shortcut Wizard dialog comes up, replace the default text that says "Shortcut", with the text the user will see that describes the document. Click Next. In the box that asks for the "Program to run..., etc." just type in the name of the file if it will reside in the same folder as the .CHM. 

Relative Path Troubleshooting: 
If you create a CD Layout and the document you're trying to bring up has a folder on the same level as the CHM folder, you would type

../Databases/WHATEVER.MDB.

If the Databases (or whatever files) are in a folder "below" the CHM folder it would be:

Databases/WHATEVER.MDB

The Wizard dialog is somewhat confusing because it asks for a "Program". In this case, you only need the document name. (e.g., WHATEVER.PPS) This assumes that the document extension is already "associated" with the application. Leave the rest of the boxes blank (parameters and such). This will create a Button in your WYSIWYG editor labeled with the text you typed in earlier.

Compile, click on the Button and the Access database (or whatever) should start with the document loaded.

Text Links instead of Buttons

You may want Text links instead of buttons, so examine these methods: 

Converting a "Button" to "Text" using a Shortcut Control to open a remote topic.

In using the Shortcut Control for linking to remote topics, you can change the parameter name from "button" to "text" by editing in TrueCode view.
Change this:
PARAM NAME="Button" VALUE="Text:Link to Remote CHM"
to this:
PARAM NAME="Text" VALUE="Text:Link to Remote CHM"

You might have to tinker with the Font parameter to make the resulting text look the way you want it.
Here's an example of the whole thing.
<OBJECT
CLASSID="clsid:ADB880A6-D8FF-11CF-9377-00AA003B7A11"
ID="Shortcut" TYPE="application/x-oleobject">
<PARAM NAME="Command" VALUE="Shortcut">
<PARAM NAME="Text" VALUE="Text:Link to Remote CHM">
<PARAM NAME="Font" VALUE="MS Sans Serif,12,0,,">
<PARAM NAME="Item1" VALUE=",Remote.chm">
</OBJECT>

After saving in TrueCode view switch to WYSIWYG editor view. Don't freak <g>. It will still show the link as a button! Not to worry. Compile the chm and you'll see it works.

Or, use hyperlinks instead of Shortcut Control

Finally, you can create hyperlinks without using the Shortcut. But the results vary according to the application. For example if you are just trying to show Word Documents in the Topic Pane you could add the Documents to "Baggage" then go into TrueCode view where you want the link and insert this code:

<A HREF="ms-its:Test.chm::/Word.doc">Name of the Word Doc</A>

Clicking on this link will cause the document to appear in the topic pane. There are no toolbars for editing, but the user can right click and bring up a brief context menu. If the doc is edited in any way and the user tries to go to another topic, a dialog prompts to save it to a drive. The major downside using this approach is that you have to compile all your docs into the CHM (the baggage part) and this may not be practical.