By now Tool Palettes have probably become a staple of your workspace. We can put all sorts of things on Tool Palettes; lines and blocks being the most common. While lines and blocks on tool palettes add a degree of sanity for many, wouldn’t it be nice if we could say add a LISP routine, VB app, even execute a script from a Tool Palette?
Well the good news is that we can, although the process isn’t necessarily obvious for many.
- Create a new Line Tool: Simply draw a line in your drawing, and add it to the desired Tool Palette.
- Adjust the Properties of your tool: Right-click on the tool, and select "Properties"
- Define the Command: From the resulting "Tool Properties" dialog, you will want to give your tool a name and description. Both of these can be anything you wish, as neither effects the tools function.
What we’re most interested in is the "Command" grouping. First you will want to disable the flyout feature by setting "Use Flyout" to "No". Next you will want to specify the command you wish to execute.
LISP: (LOAD "C:/LISP/sample.lsp");lisp command;
The above code assumes my LSP file is located on my local C-drive in a LISP folder. Do note the path mentioned in the above code is generally represented as "C:\LISP\sample.lsp". For things to work on a Tool Palette we must reverse the slash from a "\" to a "/".
SCRIPT: You can execute just about any script you want. The trick here is the use a semicolon (;) in place of line breaks. The final result will be a single-line script.
VBA: (COMMAND "-VBARUN" VBAPath " ")