Building a commercial grade lisp plugin installer in 5 easy steps

Rumors about the death of AutoLISP have been floating around for many years, but fear not, those rumors are greatly exaggerated. Bricscad and ZWCAD both have excellent support for lisp plugins, so well-written lisp code is truly cross-platform and enjoys a large and growing audience. Unlike other languages, the vast majority of lisp code works unmodified on any hardware architecture, in any version of Windows, and inside any host application that supports it, including AutoCAD versions released more than a decade ago. On top of that, OpenDCL gives lisp developers the power of a modern event-driven user interface that can put their lisp plugins on the same playing field as plugins written in any other language. This is a powerful combination, and given lisp’s low entry cost, it is not surprising to see lisp continuing to enjoy strong support in the developer community.

There’s just one thing missing: an easy way to install a lisp plugin on an end user’s computer. It’s a common refrain. How do you build a setup program for a lisp plugin? There are any number of free and low-cost installers available, but they are all designed for installing an executable program, not a plugin that must be configured to run inside a completely independent host application.

At one time there was a package called AcadInstall that was designed for AutoCAD add-ons, but that tool is long defunct. Autodesk has invented application bundles with the supposed benefit of making it easier to install and manage plugins, but these are not well documented and only work with recent versions of AutoCAD. For ManuSoft plugins, I use Visual Studio’s Setup and Deployment projects along with an extensive amount of custom C++ code to perform all the configuration necessary at install time. This works great for my needs, but it is well beyond the ability of most lisp developers.

After several recent online discussions with lisp developers struggling to get a working setup program, I set out to find a solution to this vexing problem. It turns out that after some initial work it’s actually not that hard to pull off a very professional looking setup program for a basic lisp plugin. In fact, if you follow these steps, in less than 10 minutes (5 minutes if you have a fast internet connection) you will have a working setup that installs a lisp plugin on any version of AutoCAD, Bricscad, or ZWCAD+. The best part: everything you need is free (as in beer)!

So, let’s get to it.

  1. Download and install Unicode Inno Setup QuickStart Pack from the Inno Setup Downloads page.
  2. Download my LispPluginSetup freebie and extract the files into a new folder somewhere.
  3. Download my LspLoad freebie and extract the files into a new subfolder named LspLoad.
  4. Double click on MyLispPlugin.iss. It should open in Inno Script Studio. Choose Project -> Compile.

At this point you should have a new Output subfolder with MyLispPluginSetup.exe inside. Go ahead, run it. After you’ve installed the MyPlugin sample, start the host application of your choice (the setup program configures all of them). If all went well, MyLispPlugin should display a command line message at startup alerting you to the fact that MYCOMMAND1 and MYCOMMAND2 are now available for use. Go ahead, try them. When you’re finished playing, it should uninstall cleanly (except for the new addition to TRUSTEDPATHS in AutoCAD 2014) when you choose Start -> MyCompany -> MyLispPlugin -> Uninstall My Lisp Plugin.

That was almost too easy, right? Well, not so fast. You’ll need to make some changes to adapt the sample for your own plugin. Take a look at the installation script in Inno Script Studio. Click on the Inno Setup Script item in the project tree to see the entire script as a flat file. Right near the top of the script, it should be obvious that you’ll need to change the basic plugin information preprocessor constants to adapt the script for your own plugin. Obviously your plugin will have a different base filename, and quite probably more files. It may have more registry keys and other basic setup stuff. In addition, you may not want to support all possible versions and flavors of each host app (in that case you’ll need to comment out or remove the associated item in the Files section). You get the idea, I’m sure.

Step 5 is modifying the sample script to adapt it for your own plugin. So easy, even an engineer could do it!

24 thoughts on “Building a commercial grade lisp plugin installer in 5 easy steps”

  1. Hi Owen,
    I like your way to do install script. I have a similar solution but I like to install software upon selected AutoCAD version.


    AcadVerNames, AcadVerKeys, AcadExes: TArrayOfString;

    function GetInstalledAutoCADVersions(): Boolean;
    S, V, AcadRegKey, sAcadExeLocation: String;
    //AcadVerNames, AcadVerKeys, AcadExes: TArrayOfString;
    RootKey, I, J: Integer;

    if IsWin64 then
    RootKey := HKLM64;

    AcadRegKey := ‘SOFTWAREAutodeskAutoCAD’;
    if RegGetSubkeyNames(RootKey, AcadRegKey, AcadVerNames) then
    S := ”;
    for I := 0 to GetArrayLength(AcadVerNames)-1 do
    //MsgBox(AcadRegKey + ” + AcadVerNames[I], mbInformation, MB_OK);
    if RegGetSubkeyNames(RootKey, AcadRegKey + ” + AcadVerNames[I], AcadVerKeys) then
    for J := 0 to GetArrayLength(AcadVerKeys)-1 do
    //MsgBox(AcadRegKey + ” + AcadVerNames[I] + ” + AcadVerKeys[J], mbInformation, MB_OK);
    if RegQueryStringValue(RootKey, AcadRegKey + ” + AcadVerNames[I] + ” + AcadVerKeys[J], ‘Location’, sAcadExeLocation) then
    SetArrayLength(AcadExes, I+1);
    AcadExes[I] := sAcadExeLocation;
    S := S + AcadRegKey + ” + AcadVerNames[I] + ” + AcadVerKeys[J] + ‘ = ‘ + AcadExes[I] + #13#10;
    MsgBox(‘Founded AutoCAD registry keys:’#13#10#13#10 + S, mbInformation, MB_OK);

    function InitializeSetup(): Boolean;
    Result := True;

  2. Thanks Owen, just discovered your post – this is excellent and rounds off your LispLoad offering nicely.

    I’m a great fan of Inno Setup and struggled with pascal to develop a setup script which utilises your LspLoad.arx files for demand loading. Generally I’ve had ok results however my approach is a bit flakey especially for older releases of AutoCAD. Your code is clear and comprehensive, it is very helpful!

  3. Owen,

    Thanks very much for this! It was a very timely solution for me, as I needed to distribute some lisp tools to some of our consultants. They are very good at network design, but not necessarily so at loading and using lisp tools. I was able create a setup program to load the required tools, create the demend load stubs, and even load the partial menu cuix file. What I am really unclear about though are the bitmap files required when AuoCAD Map creates the toolbars. I am pretty sure they have to be located in AutoCAD’s support files search path. Do you have any tips on how I can:
    1. install them to a folder that AutoCAD can find, or
    2. add my application BMP folder to the support file search path (something you specifically suggested to NOT do)??
    Thanks in advance!

    1. You’re welcome Kirk. Thanks for the feedback! Toolbar button bitmaps do not need to be in the support path as long as you compile the .mnr file(s) at build time and deploy them along with the associated CUI file(s). You do have to use different sets of .mnc/.cui/.cuix and associated .mnr files for various versions of AutoCAD. Take a look at my SuperPurge utility if you want to see an example of this approach in action.

  4. I gave this a shot today – works well with LISP but not with VLX ? I tried to modify this part of the code – thanks

    ;; Define autoload command stubs
    ;; * “mytest” is the lisp filename that implements the commands
    (autoload (strcat (vl-string-translate “\\” “/” (*mytest-GetAppFolder)) “/” “mytest”)

    1. You can borrow the same technique using the provided InnoSetup script as a starting point, but you should modify the script to demandload your DLL instead of the LspLoad modules.

  5. Owen, this looks like a promising replacement for AcadInst.exe, and I would like to riff on it as an open source project possibly. Would you be cooperative to possibly link to a github or elsewhere to preserve the sustainability of the project in perpetuity? And if so, might you be available to answer any questions that may arise?

    1. Tom, as long as I am still updating the files for my own use, I don’t want to duplicate my efforts elsewhere. However note that all needed source code is provided between the three downloadable files, and creating a new fork is specifically allowed. I have no problem at all if you want to do that on your own.

  6. Code works fine with *.lsp Files
    But with *.vlx files, First Code load at AutoCad startup, but second *.vlx file (XXXXCmds.vlx) return error.

    “The file /XXXXCmds(.lsp/.exe/.arx) was not found in your search path
    Check the installation of the support files and try again.nil”

    Is there any way to load this second *.vlx file within first Code
    (load (strcat (vl-string-translate “\\” “/” (Lock2Block-GetAppFolder)) “/” “Lock2BlockCmds.vlx”)

    1. If both .vlx files are in the same folder, then yes, LspLoad should be setup to load a single “main” file, which then loads all secondary files from the same folder. Use the (GetPathOfLock2Block) function to get the path that the main file loaded from.

  7. Hello, That’s amazing, I could make a setup file to my lisp program, is there a way to add a tab or ribbon without any programming( or c#) like that way or easy way?

    1. I would create a partial .cui/.cuix that defines the ribbon tab and toolbar(s), then load the partial cui. To load a partial cui by lisp, the easiest way is to call (command “MENULOAD” “my.cui”), but this needs to be done in the (S::STARTUP) function because it is not safe to call (command) before startup has completed.

  8. Is it also possible to copy some fonts to autocad installed directory with this plugin? (I could announce fonts folder to inno setup but I couldn’t find autocad directory folder to past it)

  9. It runs successfully on 64 bit, but it gives error on 32-bit at the first of setup :
    “Cannot access 64-bit registry keys on this version of windows”

Leave a Reply

Your email address will not be published. Required fields are marked *