Copied from Acad 2000/200i Forum
Date: Aug/21/01 - 19:14 (GMT)
Does anyone know of a way to assign a custom button to a function key or keyboard? Joe Kidd
From: Autodesk Product Support
Date: Aug/29/01 - 22:54 (GMT)
This is a way I've used to set my Function key to run a LISP routine in AutoCAD.
First, write a simple LISP routine that does the action you desire. Test and make sure this LISP routine can be loaded and run from the AutoCAD command line ok.
Second, open and modify the ACAD.MNU (or whatever mani MNU file you are using, by adding first an entry to the defined commands and creating your own call to the function (ID_function), then modify the ACCELERATORS section of the menu to call the function. The ACCELERATORS section is designed for defining shortcut (hot) keys to functions and commands.
OK, here is an example of the proceedure..
I wrote this simple LISP routine and saved it to my ..\AutoCAD 2002\support folder with the name dtest.lsp:
(defun c:go()
(princ "This is proof that I am running!")
(princ)
)
Then I opened my ACAD.MNU and I entered the following after the POP12 section in the menu:
***POP15
**CUSTOM
ID_MnCustom [Custom]
ID_Dtest [&Dtest](load "dtest.lsp") go;
Then I added the following to the ACCELERATORS section in the same MNU file:
ID_Dtest [SHIFT+"F9"]
I then saved the ACAD.MNU and loaded it in AutoCAD using the MENU command (see TS66049), recompiling the menus. (** Note a suggestion made elsewhere was to alter the .mns file "if you do not want to recompile .." See sippet taken from Redefining the F1 Key in Tips in www.archidigmin.com inserted below.. **)
To test it, I select either the Dtest menu choice under Custom or hit SHIFT+F9 and it should load and execute the LISP routine as specified.
Both should work. I hope that helps.
Daren Chung