Miscellaneous Stuff

Here's a bunch of projects that didn't quite get their own Gizmoware page, but that might be useful to someone. Let me know if you need source code, or if you need them to do something they currently don't.


Text File Shuffler

This opens a text file and shuffles the lines. Keeps the individual lines in tact. I needed to do this for a project and couldn't find anything that did it. Includes Python source code.


Random Movie

I got tired of choosing which Simpsons episode to watch so I wrote this little program to help me solve one of life's excruciating dilemmas. Run it from a directory with a bunch of movies and it'll randomly choose one. The zip also includes "random_song.exe", which plays a random song, and "random_file.exe", which launches a random file. New in Version 2: it now searches subdirectories too.

If you need a version that searches folders on your network, see Random Network Movie below.


Random Network Movie

This chooses a random movie or song from your whole network. You tell it where the movie and music files are on your network and it searches through all of them and chooses one at random. It caches the list of files so it's super quick. I used it on a network with 47,000 songs and it was still able to pick a song in under a second on a crappy old computer. Also lets you search for specific songs or movies, which is handy dandy when those songs are coming from like 15 computers. And can optionally return a playlist of songs or movies. Has a simple gui or can run from the command line.

Not to be confused with Random Movie above, which only picks a movie from the current folder, not the network.

Here's the readme with more info, or just download it, with Python source code.


Delete Temp Files

A simple little utility that deletes the temporary files for every user on a Windows machine. It made me crazy that Windows's Disk Cleanup utility only cleaned the files for the currently logged in user, so I made this. Prompts you before deleting the contents of each directory, and prompts for a defrag at the end, so it's easy to send to computer idiots and have them do an autopilot tune-up. Note that a good alternative to this is Crap Cleaner, which deletes even more stuff and gives a better indication of what's going on, but it has an installer and is a bit more of a production.



Allows you to set Windows TCP/IP parameters from the Windows commandline. Can set all parameters independently, meaning you can set, for example, the gateway without affecting the IP. Very useful if you have two DSL connections and want to switch between them, or a different fixed IP at home and work, etc.

All this is technically possible with the built-in Windows XP utility NetSh, but as far as I know it can't set the gateway without affecting the IP address, and it's a clunky mess even if it can.

Consider this a beta since I haven't tested it on many systems yet, let me know if it has any problems.

Includes Python source code.


Controller for the K74 parallel port relay board

I love the K74 parallel port relay board, it connects to a parallel port and has 8 relays to control 8 external devices. So, for example, you can turn lamps on and off from your computer. Works really well from scripts and programs, and only costs $35. But it has a major problem: it writes the status of all 8 relays simultaneously, so it's hard to change the state of just one relay. For example, if relay 1 and relay 3 are turned on, and you want to turn on relay 7, you have to send a long command like: relay 1 on, 2 off, 3 on, 4 off, 5 off, 6 off, 7 on, 8 off. And to make things more difficult you can't query the K74 for the status of the relays, you have to keep track of them yourself. And the icing on the cake is you have to send the command in binary or hex, which is fantastically confusing, to me at least.

And thus my program k74.exe was born. It keeps track of the other relay states by using a text file.

Shortcomings of K74.exe: it doesn't check whether the K74 received the signal, it just sends the data to the parallel port and hopes for the best. Also, it's compiled Python, which means it's big, like 3 megs. But note that if you use the Python source, it's under 1k.

Alternatives to K74.exe: the manufacturer page has a download link which includes relay.exe which lets you set all the relays at once (not individually) from commandline, but also has a GUI version that lets you control individual relays, but not from programs or scripts. And here's a program for Linux written in C that says it can control individual relays, but I can't compile C so have no way of checking it out. Note that K74.exe should work fine from Linux if you use the Python source, which is included.

Alternatives to the K74 relay board: there's also a serial port relay board that I've been coveting. As I understand it lets you control the relays independently with simple commands like relay1=on, and another nice feature is it lets you have 4 inputs. The only downsides I can see are it costs $75, they were out of stock when I checked, and sometimes I guess using a parallel port could be preferrable to a serial port. And you might also investigate a Phidget...

And note: my K74's circuit board says K74v2, but I'm guessing this'll work with all hardware versions, and may even work with other parallel port relay boards.

Python users: the source is included, and there's also a function that is meant to incorporate with your script that keeps track of all the relays internally.

See the readme for usage instructions, but the gist is:

k74.exe [relay #] [state]

For example, "k74 5 1" would turn relay 5 on, "k74 5 0" would turn relay 5 off.

Download it with Python source

Note: I drastically updated this on January 30, 2008. Much better sourcecode now.

And let me know if it doesn't work, there's a chance I need to include an extra DLL.


Prolite is one of the two main makers of those scrolling LED signs that you see in stores (the other big producer is Beta Brite). The sign is nice in that it's really easy to write to from the commandline, and it makes a hell of an LED output device. Building the cable to communicate with it is easy following these plans.

Here's the syntax for writing to the sign from the Windows commandline:

ECHO ^<ID01^>^<PA^> whatever message > COM1

Note that I'm escaping out the brackets with carrots. In the above example, I'm writing to sign 1 (<ID01>), and Page A (<PA>), and outputting it to Com1.

I got sick of commenting out the brackets, so I wrote pwrite.exe and pdelete.exe. With them, you can write to the sign as easily as: pwrite.exe "my stupid message" B (that would send the words "my stupid message" to page B). See the readme.txt for much more notes and useage instructions. Also see this excellent page for more notes and resources for the prolite sign.

Download prolite.zip, with source code


These are a couple of AutoHotKey scripts that I use often. Lets you make any program "always on top" from commandline. Useage instructions/syntax are zipped with file, but the gist is that the following command: ontop.exe "Google - Mozilla Firefox" 1 will make the window named "Google - Mozilla Firefox" be always on top. Change the 1 at the end to a 0 and you remove the always on top status.


Lets you send a keystroke to any application. All keys are sendable, including function keys, enter, shift, etc. Useage and syntax are zipped with file, but the gist is that the following command: sendkey.exe "Google - Mozilla Firefox" "whatever" sends the word "whatever" to the window called "Google - Mozilla Firefox". That "whatever" could be replaced by, for example, "{F11}" to send the F11 key. All other keys are listed in the readme.txt file.

Download these two utilities (ontop.exe and sendkey.exe), with source code.


Email if you have any questions about any of the above, or need a modification.

<<< back to Gizmoware.net