Monday, July 19, 2010

Randomizer: Random file opener written in Autohotkey

"Randomizer is a very, very small simplistic program designed to do one thing: open a random file."
Frankly, I've written an About window, the FreewareWire Software page, and a FreewareWire Software Update, which is basically saying the exact same thing in three different lengths, so I don't feel like explaining it any more.

I wrote Randomizer in about 2-3 hours, most of which were trying to find a good icon and trying to trim as many characters out of the source as possible. Oh, yeah, I forgot to mention, since Randomizer is so simple, I thought I'd have fun and try to get it to as little characters and lines as possible. When I finally finished, I got it to 40 lines and 448 characters (not counting the Help message).

I will honestly probably never edit Randomizer again, which is kind of nice for me. I just thought of an extremely potential problem, so I guess I'll have to see if I can fix it.
If you put Randomizer in an empty folder so it's all by itself and then run it with no parameters, it will search the current folder for all files and since it is the only file in the folder, it will open itself, repeating the process indefinitely. I don't think this could crash your system or anything, but it could be a nuisance. Really, it's just a few a line of code to make sure that any file can't be A_ScriptFullPath, but I'm too lazy to add it now.

[UPDATE] So apparently I had a few bugs in the code....waaaay bugs, actually, which I had to fix or Randomizer would not work at all. So while I was in there, I made it check to make sure it wasn't launching itself, and also made sure the file it was about to launch is not a System file (since I don't think people want to open Thumbs.db or Desktop.ini randomly).
Anyway, I added about 4 lines and 100 characters, but it should be working, actually more efficient now.

Anyway, check out FreewareWire Software to try Randomizer.

Peace out.

No comments:

Post a Comment