Docker or Macro Installer

Now that we have a docker or macro we may wish to install the macro or docker on one or several machines. While you could use the manual approach a simple installer would be nice so that a user could just run it and have the files installed for them. In this post we will build a simple installer that will install the docker or macro.

Needed Software

To create the installer we are going to need a couple of pieces of software, the good news is that they are both free.

First we need some software to create the actual installer. The software of my choice is: NSIS (Nullsoft Scriptable Install System) Yes this is an older product and has not been updated since 2009, but it still works well even on Windows 8. So go ahead, download and install it.

Second we need an editor to edit our script that tells NSIS how to create the installer. You could use notepad but I like to have a little syntax formatting and color so I recommend: Notepad++

Creating an Installer

Installing a docker / macro is normally pretty simple as it is a single .gms file or the docker folder. However, trying to tell a user the exact path this file needs to be placed can be difficult, and if the user is on Windows 7 or 8 the difficultly increases because of the permissions issues. Making an installer can really simplify the process.

To keep things nice and organized create a new folder with the name of your macro / docker. I normally make the folder on my desktop for easy access

In this example we will be making an installer for the modified version of Oberon's Color Replacer. You can find the GMS file here: Color Replacer Advanced Remake Place the lf_ColorReplacer29.3.8.gms file into your newly created folder. I also created a simple .ico file with CorelDRAW so the .exe file that is created will have a unique icon.

Finally place the MakeGMSInstallX4-X6.nsi file into the same folder. Open the file in Notepad++. You might look at all the code and start to get dizzy, don't worry, we are only going to focus on the first couple of lines.

Find the line that says: !define MyName "MacroName" and change the MacroName to lf_ColorReplacer29.3.8. This needs to match the name of your .gms file or the name of the folder that would have your files for a docker.

Next we modify: !define Icon "Icon", change Icon to the name of the icon you created. I named my Icon the same thing so I change this to lf_ColorReplacer29.3.8 also, if this file cannot be found the installer will look for icon.ico, I have included the icon.ico file in the zip file at the end of this article.

Finally we have: BrandingText "My Company Here", change to your company name or personal name or whatever text you would like to show in the installer.

Save the file. Close the editor. Now find the .nsi file we just modified and right click. If you have installed NSIS you should the option to Compile NSIS Script. Go for it! You should get a dialog that says it completed successfully and you will get a newly created .exe file. This .exe file is your installer.

Run the .exe and you should get a dialog to select the components to install.

All that code in the .nsi file is to detect which versions of CorelDRAW you have running on the machine, and if any CorelDRAW is open to notify you to close it before installing. As you can see from the screenshot I only have CorelDRAW X6 64-bit on this machine.

Check which versions you want the macro to install to and click Install. If the file is already there you should get a warning to overwrite, if no file is there the installer should complete successfully. It should be just that easy.

Docker Installer

To create a docker installer use the MakeDockerInstallX4-X6.nsi file, and have your docker folder in the same folder as the .nsi file. The docker name should be changed to match the name of the docker folder so it can find the files. You can have as many files as you like in the folder, the installer will grab them all.

Conclusion

In this post we created an installer to install the lf_ColorReplacer29.3.8 macro. Feel free to modify the .nsi file to make the script smarter. I would love to see what others could come up with.

In the below zipped file you will find the Docker and GMS .nsi files along with two icons and the lf_ColorReplacer29.3.8 gms file.