Archive for July, 2009


Filter files into silo folders


Recently a number of my friends have hard hard drive failures and have asked me to retrieve data from their hard drives.  I’ve been reasonably successful in each case recovering well over 95% of the data in each case – thanks not to me but the proliferation of free data recovery tools out there on the Internet.

The last one I’ve been working on however has had a particularly mangled folder structure such that a large number of the recovered files haven’t been able to be assigned the correct file name and folder.  The recovery software has auto generated file names and placed them in a single folder … all 245,528 of them.  As you might expect Windows isn’t all that happy with that many files in a single folder when you want to interact with them.

Windows Explorer is incredibly slow to interact with this amount of content and even using SnowBird the speed of access was prohibitive.  I had a need to somehow rearrange the files into some other structure and since the naming is random, the folder structure does not need to be particularly meaningful – just practical to sort through.  Given there was no (free) software up to the job and being the consummate IT support chap I am  I decided to script my way around the problem.

I wrote a VB Script to process the folder of files and to “silo” the files off into groups within other folders.  A couple of constants at the top of the script tell it which folder to process and how many files to put into each folder.  The script then calculates how many folders to create and starts to process them.  I’ve used my generic progress window to show what file is being moved and how far through the process the script is.

The script doesn’t contain anything particularly nifty that hasn’t already been covered in one of my previous VB Script posts, so rather than displaying the source code here I’ve just provided it as a download:


A Ceiling Function for VB Script


This post has now been migrated to

Follow this link to go directly to the article


Command Line Utility to Create Test Files

Using the utility on the command line

Using the utility on the command line

In the past I’ve used FSUTIL to create large test files of data to process.  Unfortunately you need administrator permissions to use this utility.  I decided to write a command line utility (called “Make Test File” but abbreviated to MTF.EXE) to allow non-administrators to do the same.  It’s written in VB.NET so it isn’t as quick as FSUTIL, but as they say “it does the job”, and it fulfilled my immediate needs.

It takes two parameters – the size of the file (in bytes) and the file path to write the file to.  To see an example of how to use it and the output click on the thumbnail image on the right.  The resulting file just contains zeros.

If there’s any demand I may look into additional features such as being able to specify what the file is filled with or creation of multiple files using some sort of incremental naming convention.


VB Script – Count occurrences in a text string


This post has now been migrated to

Follow this link to go directly to the article.


Controlling Spotify


This post has now been migrated to

Follow this link to go directly to the article.


Don’t log on as admin just yet


On Windows XP you may find that you need to carry out some tasks as an administrator for which you would logon as  an administrator (local or network/domain).  If the user is already logged on then you can choose to run as administrator for many activities by selecting run as from a file’s context menu.  However not every type of file has this option.

My preferred method to get around this is to run a file management application as an administrator and then any file action from within that is run as an administrator.  The RUNAS executable is accessible from the command line and along with the right selection of parameters should make this quite easy to do.  Unfortunately a restriction around instances (and the fact that the Windows Desktop is an instance of EXPLORER.EXE) means that EXPLORER.EXE can’t be run as – at least not without changing some settings in Windows.

The alternative is to use the fact that Internet Explorer is a standard component and has a synonymity with explorer.  So to quickly access the C drive in explorer (via Internet Explorer) I suggest popping the following line into a shortcut and deploying it to every machine or at least a quickly accessible folder on your network (with a short name you can then quickly type into a Run dialog).

runas /user:administrator "C:\Program Files\Internet Explorer\iexplore.exe c:"

This assumes your admin account is called “administrator” (add an ‘@yourdomain’ after this for domain admin access on the appropriate domain) and Internet Explorer is installed under program files in a folder called Internet Explorer.  You could similarly make this a .BAT file rather than a shortcut file (.LNK),  but I think the shortcut is a slightly neater looking option.

When run a command prompt window will be opened and ask for the password.  Type this in and press enter/return to have Windows open your nice admin file management session.  Just remember to close the window when you’ve finished … you don’t want to leave end users with admin access.


Tweet from a dumb phone

Buzby - British Telecom's old mascot

Buzby - British Telecom's old mascot ... the original Tweeter

There are lots of Twitter clients out there for smart phones, but you can also tweet from a ‘dumb’ phone.  The trick is to use a service like TwitSay or TwitterFone.  Once you register, these services give you a local telephone number to call.  You can then record a short voice message.

  • If you use TwitSay, then your message will be held as an audio recording on TwitSay and a URL will be posted to your Twitter feed.
  • If you use TwitterFone then a transcription takes place and the resulting text is posted to your Twitter feed.  TwitterFone also allows you a few additional options such as being able to listen to your Twitter feed being read to you and then being able to post responses and direct messages through the same audio transcription system.

It’s an interesting alternative interface to Twitter and one with several benefits in terms of accessibility – both in a disability sense and an availability of technology sense.  Even with a smart phone you could take advantage of these services if for example you have voice dialling enabled … not that I’d recommend tweeting whilst driving.

Interestingly both services refer only to mobile phones.  I do wonder if a land line would work too.  I can’t see any reason that it wouldn’t unless you have caller ID sending off or the services are actively blocking them.  You would however need to be able to receive a text message to the land line for activation validation purposes.  however many operators offer an SMS to audio service so even that shouldn’t really be an issue for most people.

Now I want to know when I can have a transcription take place on my phone without using a service so that I can just dictate a tweet (or an SMS) and not even have to pay for the local call – just make use of the data plan instead.


iPhone and UK Train Times


National Rail Enquiries in the UK have cornered the market for iPhone apps for UK rail.  It used to be open and there apparently used to be a pretty reasonable app out there for free.  National Rail’s app on the other hand is not as nice and costs a few too many pennies for many people.

I used to use a WAP version on my old phone and I still use it through a WML browser add-on for Firefox when I need super speedy quick access or am on a really slow connection – such as that on the East Coast mainline trains.  However the iPhone’s Safari browser doesn’t support WML.  However there is another alternative that has a lightweight portal for the small screen – National Rail’s PDA page.

I’m not currently an iPhone user myself but I’ve suggested this to a few people and they seem to find it a viable and practical alternative to the National Rail iPhone app.


Presentations – Keeping your screen active


Power saving options on computers are something that I personally think are great.  They not only help reduce carbon footprints, but they also help draw out even more life from your laptop battery.   One of the main ways in which this is done (others being things such as disabling hardware) is by having an inactivity option that turns off the screen and the hard disk after a period of inactivity.  Unfortunately there are times when this isn’t something you want.  The primary example of this is when you are giving a presentation.

The typical way of overriding this in Windows is to change what power saving scheme is being used through the Windows control panel or a third party application that links directly to these options.  However sometimes end users don’t have access to this.

This typically occurs where a group policy has been applied to stop users ‘tinkering’ with the power saving schemes.  Users with access can amend or delete power saving schemes which can lead to complications with machines and so it is not that uncommon to restrict access.

Whilst applications such as Microsoft PowerPoint can lead the OS into knowing that it should keep things like monitors on if a presentation is in a browser or some other “power unaware” application, then power saving actions can kick in.

I decided to apply a brute force solution to this by creating an AutoHotKey script to send a key press to the OS at regular intervals.  By default it sends a Shift key press as this is least likely to have any impact on any application, but this can be modified along with the frequency with which it is sent by the use of a settings file.  The settings file also includes an option to choose whether to start sending key presses as soon as it is run.

The code for the script is given at the end of this post, but I have also compiled this into a stand alone executable that you could even pop onto your flash drive if you’re going to be presenting on someone else’s PC.  Similarly you could add it into your start-up group (with it set not to auto start sending key presses) so it is always there when you need it.

The script places a monitor icon in the system tray.  When it is black power saving actions through inactivity will take place.  When it is blue, key presses will be sent.  Right clicking on the icon will display a menu with an override option.  Selecting this option will place a check mark next to it which will set the icon blue and initiate the override mode.  Selecting the option again will uncheck it, set the icon black and turn off the override mode.

Only one setting is available on the settings menu.  This is another check item and determines whether override mode should be enabled immediately when the utility is first started.

The utility looks for a settings file called ActiveDisplay.ini in the folder from which the utility is being run.  If it does not exist, the utility will use its default settings which match the settings given in this example file:

;Set to 1 to enable override mode at start-up and 0 to disable.
;Specify what characters should be sent.  Use {} for special key strokes
;Number of milliseconds between sending the key strokes (120,000 milliseconds : 2 minutes)

If you want to tweak the script to meet your own needs you can get the details below and use your own icons.  If you want to get the compiled version you can download it for free.


;Read in settings
iniread, EnableAtStartup, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun, 0
iniread, KeyStroke, %A_ScriptDir%\ActiveDisplay.ini, Settings, KeyStroke, {Shift}
iniread, Period, %A_ScriptDir%\ActiveDisplay.ini, Settings, Period, 120000

;Create the tray menu
menu, tray, add, Override, Override
Menu, SettingsMenu, add, EnabledAtStartup
Menu, tray, add, Settings, :SettingsMenu
menu, tray, add, About
menu, tray, add, Exit
menu, tray, nostandard

;Time to do something that seems crazy - we'll flip these and then call the menu selection routines where it will get flipped back
EnableTimer := EnableAtStartup
EnableAtStartup := Not(EnableAtStartup)
GoSub, EnabledAtStartup
EnableTimer := Not(EnableTimer)
GoSub, Override


Send %KeyStroke%

EnableTimer := Not(EnableTimer)
If EnableTimer
 menu, tray, Check, Override
 menu, tray, icon, C:\Icons\Monitor On.ico
 menu, tray, tip, Default Power Saving Mode Overridden
 SetTimer, SendKeyStroke, %Period%
 menu, tray, UnCheck, Override
 menu, tray, icon, C:\Icons\Monitor Off.ico
 menu, tray, tip, Default Power Saving Mode
 SetTimer, SendKeyStroke, Off

EnableAtStartup := Not(EnableAtStartup)
If EnableAtStartup
 menu, SettingsMenu, Check, EnabledAtStartup
 iniwrite, 1, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun
 menu, SettingsMenu, UnCheck, EnabledAtStartup
 iniwrite, 0, %A_ScriptDir%\ActiveDisplay.ini, Settings, EnableOnRun

MsgBox, 0, About Active Display, Version 1.0`nCopyright 2009 RebootIT`n`n


A Flexible Progress Window in VBScript


This post has now been migrated to

Follow this link to go directly to the article.