setfunhelp

AutoCad AutoLISP Functions

 
setfunhelp
 
 
 

Registers a user-defined command with the Help facility so the appropriate Help file and topic are called when the user requests help on that command

(setfunhelp c:fname [helpfile [topic
[command]]])

Arguments

c:fname

A string specifying the user-defined command (the C:XXX function). You must include the c: prefix.

helpfile

A string naming the Help file. The file extension is not required with the helpfile argument. If a file extension is provided, AutoCAD looks only for a file with the exact name specified.

If no file extension is provided, AutoCAD looks for helpfile with an extension of .chm. If no file of that name is found, AutoCAD looks for a file with an extension of .hlp.

topic

A string identifying a Help topic ID. If you are calling a topic within a CHM file, provide the file name without the extension; AutoCAD adds an .htm extension.

command

A string that specifies the initial state of the Help window. The command argument is a string used by the uCommand (in HTML Help) or the fuCommand (in WinHelp) argument of the HtmlHelp() and WinHelp() functions as defined in the Microsoft Windows SDK.

For HTML Help files, the command parameter can be HH_ALINK_LOOKUP or HH_DISPLAY_TOPIC. For Windows Help files, the command parameter can be HELP_CONTENTS, HELP_HELPONHELP, or HELP_PARTIALKEY.

Return Values

The string passed as c:fname, if successful; otherwise, nil.

This function verifies only that the c:fname argument has the c: prefix. It does not verify that the c:fname function exists, nor does it verify the correctness of the other arguments supplied.

Examples

The following example illustrates the use of setfunhelp by defining a simple function and issuing setfunhelp to associate the function with the circle topic in the AutoCAD Help file (acad.chm):

(defun c:foo ()
  (getstring "Press F1 for help on the foo command:")
)
(setfunhelp "c:foo" "acad.chm" "circle")

After this code is loaded, issuing the foo command and then pressing F1 displays the circle topic.

This example works, but serves no real purpose. In the real world, you would create your own Help file and associate that Help file and topic with your function.

Define a function named test:

Command: (defun c:test()(getstring "\nTEST: " )(princ))

C:TEST

Associate the function with a call to Help with the string “line”:

Command: (setfunhelp "c:test" "acad.chm" "line")

"c:test"

Run the test command and at the prompt, press F1; you should see the Help topic for the AutoCAD LINE command.

NoteWhen you use the defun function to define a C:XXX function, it removes that function's name from those registered by setfunhelp (if one exists). Therefore, setfunhelp should be called only after the defun call, which defines the user-defined command.
See Also