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, any version of Bricscad, and ZWCAD+ 2014. 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!

 

10 Comments

  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.

    Cheers
    Veli

    [Code]
    var
    AcadVerNames, AcadVerKeys, AcadExes: TArrayOfString;

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

    begin
    if IsWin64 then
    begin
    RootKey := HKLM64;
    end
    else
    begin
    RootKey := HKEY_LOCAL_MACHINE;
    end;

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

    function InitializeSetup(): Boolean;
    begin;
    GetInstalledAutoCADVersions();
    Result := True;
    end;

  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. Quinoa seeds when cooked are easily digested andd gluten free.

    For convenience,I just eat the same foods everyday. Ingredients of this herbal slimming
    supplement are completely natural such as Babuna (Matricaria Chamomilla), Jwasa
    (Alhagi Maurorum), Bair (Zizyphus Jujuba), Bhadradanti (Jatropha Multifida),
    Pashanbhed (Coleus Aromaticus), Katha (Acacia Catechu), Chandras (Veteria
    Indica), Kulthi (Dolichos Biflorus), Kaligiri (Vernonia Anthelmintica), Babool (Acacia
    Arabica Wild), Gurlu (Coix Lachryma), Laksha (Cocus Lacca), Piplamool (Piper longum), Samudra Shosh (Argyreia Speciosa),
    Haritki (Terminalia Chebula), and Chitrak (Plumbags Zeylanica).

    Feel free too visit my homepage;dimagrire pancia (Alejandro)

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>