Archive for February, 2009

In Here I Am God Is Going LDoA

Saturday, February 28th, 2009


Legendary Defender Of Ascalon (LDoA) is a title that one can obtain by reaching level 20 in Guild Wars Prophecies before The Searing. My character named "In Here I Am God" (named after a line from Lawnmower Man) is at lvl14 now and is expecting a crapload more death leveling.

In Here I Am God going for LDoA title

I Rock… And So Does NSIS

Saturday, February 14th, 2009


Being a bit of a computer goof, I am frequently asked to maintain PC's for people I know (and sometimes people I have just met). For the most part, I don't really mind doing this, but there are times when it can be a pain in the ass. One thing that is typically a pain is reinstalling and then reconfiguring software… especially software like Mozilla Firefox. For anyone who doesn't know, Firefox is a web browser application. Lately I have also been plagued with the fact that Mozilla has released Firefox 3 which also happens to be pretty crappy. I was thoroughly disappointed with FF3 and even more disappointed with it's Awesome Bar (which turns out to be an absolutely Craptastic Bar). This new bar has some truly annoying features, some of which can not be turned off.

So what do I do? Use FF3 and its garbage bar? Switch to IE7 and get script kiddie'ed? Switch to some other browser that has a poor interface? Buy a Mac? I determined that Firefox v2.x was my favourite browser to date and that I should go back to it. The bad news is that Firefox v2.0.0.20 is the last release of the 2.x series and is officially discontinued. Now what?

I decided to make my own installation of Firefox v2.x and customize it the way I like it. To make it as "safe" as possible I wanted it to have Adblocker Plus, Customize Google, and Cookie Safe. I also wanted to customize the settings to fit my needs (such as toolbars, search engines and cookie exceptions). I was hoping to do this with a simple BATch file but that was hardly elegant. So I looked around for something to create a nice .MSI for me, that way I could take advantage of the Windows Installer for my customization. The applications out there that make MSI's is less than stellar. NSIS to the rescue!

NSIS Is the Nullsoft Scriptable Install System, and it rocks. It is [essentially] a programming language that is similar to C in many respects. Now I have done some programming before but I usually hate it. I hate the way documentation for programming languages is written for an audience that already knows some programming. There is always a "Hello World" example and then everything after that is up to you to figure out. Now simple stuff isn't too bad, you look up a sample script and modify it to suit your needs… but anything complicated can be a bastard to write if you are not familiar with some standard procedures. One of my examples was that I wanted to take a string and search it for a certain character, if it was found it should be replaced with a different character. Sounds simple enough, but there is no "replacechar" function and I suck at string manipulation. The forums have some help but it would be really nice if there were more sample scripts that include simple tasks like character replacement. In the end, I got it working with a StrCpy (as you'll see later).

Now that I have it working, it is actually pretty sweet. I have a single executable file (about 6.5M in size) that gives one warning box. If you agree, it will: install Firefox, disable the Import Wizard, setup a default profile, install some plugins, set it as default browser, configure everything from toolbars to plugins, and then exit. All this was only 4k [including comments] to write. Rather than posting the full text of the script I'll just post This Link to it. If you want to build your own completely customized install of FireFox, here's the steps:

  1. Get VMWare Workstation (it is seriously MUCH easier this way)
  2. Create a NSIS virtual machine and a TEST virtual machine (both of mine were XP)
  3. Download and install NSIS on the NSIS virtual machine
  4. Download and install a text editor with line numbering for editing your script (I use ConTEXT but you may find one with highlighting for NSIS)
  5. Create a folder on your NSIS box for all your source files
  6. Fill that folder with your source installers (Like Firefox, plugins, etc)
  7. Take a VMWare snapshot of your "base install" TEST machine
  8. Install Firefox and all plugins and search engines and blah blah
  9. Configure all your Firefox settings and toolbars the way you like them
  10. Copy the config files from your Firefox profile to your source files (see step 5)
  11. Modify my script [Install_Firefox.nsi] to suit your needs
  12. Recompile your script into an .exe and fill your boots

OK, it may not be quite that simple… you may have to screw with a few things to get it going but these tips may help you find what you need:

When I first started out it seemed simple enough, just run the Firefox setup program with a /S switch to make it install silently. But as I wanted to do more it became increasingly complicated. I noticed that the first time I ran my new Firefox it would start the Import Wizard and ask me to import crap from Internet Explorer. I found out that placing a special file called override.ini in my Firefox directory would disable this. Then I wanted to have my custom install use my preferences for my toolbars (like no bookmarks toolbar, and a Print icon on my regular toolbar). I also wanted all my configuration settings [everything under Tools -> Preferences] to be automatic. I found out that there are a whole bunch of files that control these things in my Mozilla profile directory. The problem was that Firefox was creating profile folders with random names (such as f83d7a90.default), so how could I tell my script where to copy files to? Well I read the profiles.ini file and find out what the path is from that (see my script for annoying StrCpy command to extract the profile folder name). Now I could copy all my saved configuration files into the profile directory.

Out of breath yet? Not me… I'm going to see if I can setup preconfigured installs for a bunch more applications!