Lisp Help.
When writing any sort of AutoLisp routine, one should supply some kind
of Help. An Information box is also a handy thing to include as it allows
you to inform the user of what version of the routine he is using, as well
as giving you a chance to advertise yourself and your applications.
You can access and integrate custom Help into the Windows Help Files, but
this is quite an involved process and you need the brains of a rocket
scientist to accomplish this.
A much simpler way is to call an external Help or Info file from your
AutoLisp routine. Using the following routine, if you click on the Help
button, your default browser will open, displaying an HTML Help file.
Clicking on the Info button, will open Notepad and display an Info Text
file.
Note: Please ensure that all files are in your AutoCad search path.
Here's the DCL Coding :
lisphelp : dialog {
label = "Lisp Help Tutorial" ;
ok_cancel_help_info ;
}
And now the AutoLisp Coding :
;;; ----------------------------------------------------------------
(prompt "\n Type LISPHELP to run....")
;;; ----------------------------------------------------------------
(defun C:LISPHELP (/ USERFLAG1 USERFLAG2 USERFLAG3 HE INF DCL_ID)
(setq DCL_ID (load_dialog "lisphelp.dcl")
) ;_ end of setq
(if (not (new_dialog "lisphelp" DCL_ID)
) ;_ end of not
(exit)
) ;_ end of if
(action_tile
"accept"
"(done_dialog) (setq userflag T)"
) ;_ end of action_tile
(action_tile
"cancel"
"(done_dialog) (setq userflag nil)"
) ;_ end of action_tile
(action_tile
"help"
"(done_dialog) (setq userflag1 T)"
) ;_ end of action_tile
(action_tile
"info"
"(done_dialog) (setq userflag2 T)"
) ;_ end of action_tile
(start_dialog)
(unload_dialog DCL_ID)
(if USERFLAG
(alert "You selected O.K.")
) ;_ end of if
(if USERFLAG1
(HEL)
) ;_ end of if
(IF USERFLAG2
(IN)
) ;_ end of IF
(princ)
) ;_ end of defun
;;; ----------------------------------------------------------------
(defun hel ()
(if (not
(setq HE (findfile "Help.htm")
) ;_ end of setq
) ;_ end of not
(alert "Sorry - Help File Missing")
(command "Browser" HE)
) ;_ end of if
(princ)
) ;_ end of defun
(defun in ()
(if (not
(setq INF (findfile "Info.txt")
) ;_ end of setq
) ;_ end of not
(alert "Sorry - Info File Missing")
(startapp "notepad.exe" INF)
) ;_ end of if
(princ)
) ;_ end of defun
(princ)
;;;EOF
;;; ----------------------------------------------------------------
To download this Tutorial just Click Here.
(16 Kb) |