Miscellaneous Software

This is a place for some of the smaller Windows programs I've writen which you may find useful, and may not. They are all free and include C++ source. Larger programs have their own, separate pages.

Use this stuff at your own risk and remember that these are quick hacks so don't expect much.


auto m3u 1.0.0.4

autom3u1004.zip (49k) (PGP Sig)

Within the "current" directory, autom3u will scan sub-directories for files. (It does NOT scan recursively.) Any directories which have "music files" but no .m3u file will have a simple .m3u generated inside of them. This .m3u file will be named the same as the directory and will contain a sorted list of found music files. A shortcut to the .m3u file will be made in the "current" directory.

The program considers these extensions to be "music files":

  • .mp3
  • .ogg
  • .flac
  • .wma
  • .aac
  • .mp4
  • .shn
  • .mp2

Easier than making playlists and shortcuts by hand after ripping a load of CDs. It does exactly what I needed but not much more so let me know if there's any minor changes that would make it more useful to you.


UniqueNames 1.0.0.1

UniqueNames.zip (36k) (PGP Sig)

UniqueNames will scan a directory hierarchy and ensure that all filenames within it are unique. If this isn't the case then clashing files will be renamed by adding "_x" to their end (before the extension if there is one) where x is a number. It's a bit like DirFlatten, below, except that it keeps the directory hierarchy and renames things differently.


DirFlatten 1.0.0.1

DirFlatten1001.zip (51k) (PGP Sig)

DirFlatten will recurse through a directory structure and move all files to the initial directory, renaming them in a way which means they will not clash with each other. This is something I hacked together so that I could use wget to mirror bits of web sites and then not have to sift through directory hierarchies.

These days I usually use one of Directory Opus's Flat View modes to see the folder and sub-folder contents together instead of moving things around with DirFlatten.

Example:

Say you have a directory structure like this:

phgreece2001\index.html
phgreece2001\images_large\pan_beach.jpg
phgreece2001\images_large\pan_church.jpg
phgreece2001\images_large\pan_view3.jpg
phgreece2001\images_large\par_church.jpg
phgreece2001\images_thumbs\TN_pan_beach.jpg
phgreece2001\images_thumbs\TN_pan_church.jpg
phgreece2001\images_thumbs\TN_pan_view3.jpg
phgreece2001\images_thumbs\TN_par_church.jpg
phleo\index.html
phleo\images_large\nudel-HairyMonster.jpg
phleo\images_large\nudel-tired1.jpg
phleo\images_large\nudel-tired2.jpg
phleo\images_thumbs\TN_nudel-HairyMonster.JPG
phleo\images_thumbs\TN_nudel-tired1.JPG
phleo\images_thumbs\TN_nudel-tired2.JPG
phother\index.html
phother\images_large\nudebot.jpg
phother\images_large\proz_print_lq.jpg
phother\images_thumbs\TN_nudebot.JPG
phother\images_thumbs\TN_proz_print_lq.JPG

Running DirFlatten on it will move the files to produce this listing:

0_images_large_pan_beach.jpg
0_images_large_pan_church.jpg
0_images_large_pan_view3.jpg
0_images_large_par_church.jpg
0_images_thumbs_TN_pan_beach.jpg
0_images_thumbs_TN_pan_church.jpg
0_images_thumbs_TN_pan_view3.jpg
0_images_thumbs_TN_par_church.jpg
1_images_large_nudel-HairyMonster.jpg
1_images_large_nudel-tired1.jpg
1_images_large_nudel-tired2.jpg
1_images_thumbs_TN_nudel-HairyMonster.JPG
1_images_thumbs_TN_nudel-tired1.JPG
1_images_thumbs_TN_nudel-tired2.JPG
2_images_large_nudebot.jpg
2_images_large_proz_print_lq.jpg
2_images_thumbs_TN_nudebot.JPG
2_images_thumbs_TN_proz_print_lq.JPG
phgreece2001_index.html
phleo_index.html
phother_index.html


FileTypeDiag 1.0.0.2

FileTypeDiag1002.zip (86k) (PGP Sig)

FileTypeDiag is tool to help diagnose problems or differences with file-types on different machines. For example, it can help see why the "wrong" program launches when a file is double-clicked. You give the program a file extension (or leave it blank to save details about folders/directories) and it will create a text file containing the registry settings which relate to that file-type.

The output includes both 32-bit and 64-bit registry SAMs1 as well as separate logs of HKCU, HKLM and the merged HKCR. The "*" file-type is always included in addition to the specified type. ProgIDs are searched, including via the OpenWith lists and Explorer's extension mappings. When the extension is left blank the tool will save both the Folder and Directory file-types to the same file.

(1: Logging both 32-bit and 64-bit SAMs is probably overkill, since the HKCR part of the registry should not be virtualised for 32-bit processes, but it doesn't hurt to be thorough and it's easy to ignore the extra data. Also, the program may log some Explorer settings from areas that are virtualised.)

FileTypeDiag screenshot


LoadString 1.0.0.1

LoadString1001.zip (46k) (PGP Sig)

LoadString.exe will print a string resource from a DLL file.

For example, if you see something like @%SystemRoot%\system32\shell32.dll,-9227 in the registry and want to know what that string actually is you can use this tool to find out. Strings like that are common in the registry on Windows Vista, due to the way localisation works, which can make things difficult when you are trying to diagnose what's in the registry.

Usage:
 LoadString.exe <path to dll> <resource id>

Examples:
 > LoadString.exe %SystemRoot%\system32\shell32.dll -9227
 String resource = "Documents"

 > LoadString.exe %SystemRoot%\system32\shell32.dll -30598
 String resource = "PNG Image"

ListPFRO 1.0.0.2

ListPFRO1002.zip (25k) (PGP Sig)

ListPFRO will list the pending file rename operations, showing you which files will be moved or deleted during the next reboot. Win9x users can get similar information by looking in WININIT.INI in the Windows directory but NT-based operating systems store this in a registry value which you can't read properly with pre-XP RegEdit.

Normally you should run ListPFRO with no arguments to see details of pending moves and deletes. You can also add the "terse" argument,

ListPFRO terse
to make the program print either "Reboot", if there are any pending operations, or nothing at all if there are none. I use this as part of my Samurize meter to give a quick on-screen indication that a reboot is needed. (Clicking the Reboot label then runs ListPFRO without arguments and in a new window so I can see the full list.)

Samurize meter example


OpenContainer (By Jonathan Potter)

opencont.zip (14k) (PGP Sig)

Command-line program which, when given a .lnk (shortcut) file, will open the parent directory of the pointed-to file.

I used to use this on an Opus filetype context menu so that I could jump to the file a shortcut points to:

OpenContainer context menu setup

(Unlike the other things on this page, I didn't write this. Jon made it a while ago and I find it useful and figure other people may too, so here it is.)

This functionality is now built-in to Opus (8.0.3.2) which also allows things like "Go NEWTAB=nofocus OPENCONTAINER=target" to open the containers of all selected shortcuts into new tabs.


ScreenSave 1.2.0.0

ScreenSave1200.zip (64k) (PGP Sig)

Command-line program which can:

  • immediately (or on a delay) start the screen saver
  • immediately (or on a delay) put your monitors into a low-power or power-off state
  • disable / enable the screen saver idle timer
  • disable / enable the monitor power-off idle timer
  • disable / enable the system sleep/hibernate idle timer

Personally, I've put the program on an Opus toolbar button for when I go out or go to bed. When I'm going to bed the delay arguments mean I can use the light from my monitors to find my duvet and avoid tripping over the cat before I'm plunged into darkness. When I'm going out I can make the monitors turn off immediately to avoid wasting power.

The options to prevent the screen saver and power-off may be useful for presentations (though a lot of presentation software will disable those things by itself.)

The ability to prevent a system from sleeping or hibernating can be useful when you need to leave a computer on but unattended, performing a task that will not prevent shutdown of the machine by itself.

(Of course, you can disable your screensaver and sleep/hibernate timers via Control Panel. The tool is for when you need to control them via a script or similar.)

Usage:

       ScreenSave [/delay [number of seconds]] [/screensaver] [/lowpower] [/poweroff]

/delay defaults to 10 seconds if no number given.

You can give multiple /delay arguments. For example, this will wait 10 sec then run the screen saver, wait another 20 sec, then turn off the monitor:

       ScreenSave /delay 10 /screensaver /delay 20 /poweroff

Monitor power-off will not lock your workstation by itself. If your screensaver is configured to lock the computer then you can use the command below to immediately turn your monitors off and lock the machine:

       ScreenSave /screensaver /poweroff

You can also enable/disable the screensaver, monitor power-off and system sleep/hibernation:

       ScreenSave /disableSaver
       ScreenSave /enableSaver
       ScreenSave /disablePowerOff
       ScreenSave /enablePowerOff
       ScreenSave /disableSleep
       ScreenSave /enableSleep

Those options can be combined. For example:

       ScreenSave /disableSaver /disablePowerOff /disableSleep

If you disable sleep/hibernation with /disableSleep then a copy of ScreenSave.exe will run in the background until you enable it again with /enableSleep. The background process will consume virtually no memory or CPU. This is similarly true if you disable monitor power-off.

Calls to /disablePowerOff and /disableSleep will nest. You must call the respective /enable* commands an equal number of times to undo them. On the other hand, calls to /disableSaver do not nest.

History

Version 1.2.0.0 (05/Dec/2008): Added the ability to enable/disable the screen saver, monitor power-off and system sleep/hibernation idle timers.

Version 1.1.0.0 (04/Feb/2007): No longer sends broadcast messages to all windows since this is a bad thing to do. Instead it creates its own window and sends messages to that. Also tested under Vista.


SetClip 1.2.0.1

SetClip1201.zip (59k) (PGP Sig)

Command-line program which puts either a file or whatever arguments you give it into the clipboard.

Usage 1: SetClip [-l] [-a] [--] <arg1> <arg2> ...

The arguments will be put in the clipboard with each one on a new line.
Use quotes around arguments containing spaces that you want on the same line.
Use "" for a blank line.
Give the -l argument to output everything on one line instead.
Give the -a argument to append to any existing clipboard text.
Give the -- argument if you want to actually put "-l", "-f", "-e", "-a" or "--" into the clipboard.

Usage 2: SetClip -f [-l] [-a] [--] <filename>

The file will be read and put into the clipboard as text.
Give the -l argument to avoid adding a return when appending to existing text.
Give the -a argument to append to any existing clipboard text.

Usage 3: SetClip -e

The clipboard will be emptied.

If you use SetClip within Directory Opus functions to copy directory paths then you may find you have to add the "noterm" argument to stop Opus from adding a trailing slash to the end of the path. If a path is quoted and ends in a slash it seems to confuse SetClip's command-line parsing. This behaviour is not Opus-specific but a "feature" of either the Microsoft C-runtime used by SetClip or the parsing in the Windows cmd.exe.

If you're using SetClip outside of Opus and actually need a slash at the end then you have to double it up for some reason, if it's before a quote.

SetClip.exe {sourcepath$|noterm}
Command-LineResult
SetClip.exe Moo\Cow\Moo\Cow\
SetClip.exe "Moo\Cow"Moo\Cow
SetClip.exe "Moo\Cow\"Moo\Cow"
SetClip.exe "Moo\Cow\\"Moo\Cow\

Note 1: The "noterm" option was added in Opus 8.0.1.0 and won't work in earlier versions.

Note 2: Directory Opus 9 added a new, built-in Clipboard SET command which makes SetClip.exe largely obsolete. SetClip is still useful for a few things (changing the clipboard from outside of Opus; putting files (rather than command-line arguments) into the clipboard; splitting the clipboard text into multiple lines; emptying the clipboard) but for the majority of cases the built-in Clipboard SET command handles the job without the need for an extra exe.

Example Directory Opus button (or hotkey) which copies the contents of the selected files to the clipboard:

@runmode hide
"C:\Windows\System32\SetClip.exe" -e
"C:\Windows\System32\SetClip.exe" -f -a {filepath$}

Here's the Opus button in XML format so that you can paste it straight from your browser to your Opus toolbar, as described in detail at the Opus forums:

<?xml version="1.0"?>
<button display="both">
	<label>Contents to Clipboard</label>
	<tip>Copies the contents of the selected text files to the clipboard</tip>
	<icon1>#clipcopy</icon1>
	<function type="batch">
		<instruction>@runmode hide</instruction>
		<instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -e</instruction>
		<instruction>&quot;C:\Windows\System32\SetClip.exe&quot; -f -a {filepath$}</instruction>
	</function>
</button>

Both versions of the button assume that SetClip.exe is in C:\Windows\System32; if it isn't then you should make the obvious edits.


WaitDel 1.0.0.1

WaitDel1001.zip (29k) (PGP Sig)

Command-line program which waits a given amount of time for a list of files to appear in a directory, deleting each file as it appears (or immediately if it's there from the start).

I wrote this simple program because every time I logged on to my work computer a load of unwanted shortcut icons are dumped on my desktop. I made a batch file which runs WaitDel on startup so that the files are deleted once they appear.

Usage:

WaitDel <directory> <wait seconds> <filename> [filename...]

Example:

WaitDel "C:\Documents and Settings\LeoD\Desktop" 15 "Acrobat Distiller 5.0.LNK" "Lotus Notes 6.5.LNK" "Microsoft Access.LNK"