USB Detect & Launch Version 1.4 Released

USB D&L This new version includes the ability to detect when devices with no label are inserted. This is handy when you have a whole stack of new devices that you need to put data onto.

Here’s an example of the syntax you’d use:

label:(no label)
exec:”c:\batch\batch-no-label.cmd” %1 %2

Click over to the software page for the download.

New App: Screen Saver Killer

Some businesses enforce a corporate policy whereby your screensaver is set globally and is locked down so that you can’t change the settings.

In a whole bunch of scenarios, this is the last thing you want. Here are a few examples:

  • During a presentation consisting of a video, the screen saver will activate after the period defined by your IT department
  • On the big screens they put up on walls to show corporate messages/stats/etc you don’t want the screen saver activating when these screens are driven by a PC which is logged into a user account.
  • You’re not working on your laptop, but have the screen open so that you can keep an eye on your inbox, or a system monitor tool. If the screen saver kicks in every 10 minutes it can get very tedious unlocking the thing each time >:-(

Screen Saver Killer is a very simple app that will give you back control over your screen saver settings.

Click through for the download.

Spoken Caller Id on your PC using YAC

My project to get Caller ID detected on a PC off a UK landline is nearly complete. Click here to read about the full project, which includes finding a compatible modem, sending the caller ID to other PCs (or XBMC) on your network, and generating an RSS feed of incoming calls.

On my gaming box, the standard YAC notifications for a new call won’t be seen whilst I’m actually in a game:

YAC

Having the option for the PC read out the caller information would overcome this. YAC in it’s current incarnation (v0.16) doesn’t support speech, but fortunately the author has made the source code available under the GPL :-)

Extending YAC

The changes I made to YAC were kept as generic as possible (i.e. they’re not specifically tied to text-to-speech). When an incoming call is detected by YAC it does the usual notifications, but also executes a script called yac-helper.cmd (if it exists in the same folder as yac.exe).

Parameters are passed into yac-helper.cmd that enable you to do whatever you like with the incoming call. In my case, I’m simply passing control to a piece of VBScript that instantiates the Microsoft text-to-speech engine.

Sample Scripting

Here’s some sample code (which is included in the unofficial YAC 0.17 build I’m hosting on this site):

yac-helper.cmd

@echo off

rem  ----------------------------------------------------------
rem  Matt Collinge :: www.mattcollinge.co.uk :: 17 April 2007
rem  ----------------------------------------------------------
rem  Helper Script for YAC 0.17. When present in the same 
rem  folder as "yac.exe" this will be run each time a call is 
rem  received. The type of data being passed through 
rem  in %2 & %3 is specified in %1. 
rem  
rem    %1 = ( call | message )
rem    %2 = either the calling number or text-based message
rem    %3 = the calling name (not set for a text-based message)
rem  ----------------------------------------------------------

rem This next line simply passes the parameters on to a piece of VBScript. But you can
rem modify this line to call any app you like :)

wscript "c:\\yac\\yac-speech.vbs" %1 %2 %3

yac-speech.vbs

' --------------------------------------------------------
' Matt Collinge :: www.mattcollinge.co.uk :: 17 April 2007
' --------------------------------------------------------
' Take an incoming call from YAC and use the default voice
' to speak it back to the user.
' --------------------------------------------------------

Dim voic
Dim message
Dim messagePrefix

calltype = WScript.Arguments(0)

Set voic = WScript.CreateObject("SAPI.SpVoice")
Set voic.voice = voic.GetVoices("", "Language=809").Item(0)

select case calltype
	case "call"
		sNumber = WScript.Arguments(1)
		sName = WScript.Arguments(2)
		if (sName = "No Name") then
			messagePrefix = "Incoming call from number "
			message = sNumber
		else
			messagePrefix = "Incoming call from "
			message = sName
		end if
	case "message"
		message = WScript.Arguments(1)
		messagePrefix = "Incoming message "
end select

voic.Speak(messagePrefix + message)

Set voic = nothing

Job Done

When an incoming call is sent to the YAC listener on my gaming PC, it will fire the scripts above and text-to-speech allows it to read out the caller info. Dead simple really.

Voices

The default voices that are installed with XP are pretty basic, but you can buy others that sound spot on. Try out the AT&T Natural Voices demo for an idea of how good it can sound.

Downloads

Below you’ll find an unofficial build of YAC 0.17 (which I’m hosting until the original author integrates similar changes into the main build). Full source code for this build is also available, and is licensed under the GPL.

YAC 0.17 binaries for win32 (tested on XP)
YAC 0.17 source code

Build 0.17 Installation Instructions

I couldn’t be bothered creating an installer for this unofficial build. You’ve read this far so you must like messing with code, and don’t mind extracting a few files from a .zip

  • First off install 0.16 from the original author’s website
  • Next, simply extract the files in the binaries .zip file over the top of the 0.16 files
  • Edit yac-helper.cmd to your liking (including the path to yac-speech.vbs if you’re trying this example)
  • Run YAC and try testing the listeners to see if everything works

Caller Id Revisited

For a while the caller id project has been on the back burner as I’ve been working on other things and have upgraded my gaming PC. I’ve now got the time and inclination to revisit the caller id project in an attempt to get a reliable/working solution.

The aim of the project is to detect an incoming phone call and do the following:

  • Log the call to an RSS feed (useful for knowing when someone important has tried to contact me whilst I’m at work)
  • Broadcast the caller id info to devices on my network. This includes the Xbox running XMBC and CallerIdLite, a couple of laptops, and a gaming PC.

Detecting an incoming call is achieved by attaching a suitable modem to a server & have the PC log the call.

Although I initially had the US Robotics modem working, it suffered from the DSR Drop problem and I never did get a permanent fix :( In the end, I sold it on eBay and bought a different brand.

I’m now using an external Pace 56 Voice Modem (firmware drivers available here and modified modem driver that supports calller id in the UK here) which works perfectly and gives me an opportunity to complete this project.

Now that the incoming calls are reliably detected and the caller id is being distributed across devices on the network using YAC, the one thing left to perfect is the notification on my gaming PC. In a game the standard YAC popup won’t be visible, therefore the ideal solution is for the id to be read out using text-to-speech :-)

YAC doesn’t currently support this kind of thing, but fortunately the guy who wrote it made the source code available under the GPL. My next post will cover how I’ve extended YAC to do text-to-speech.

USB Detect & Launch Version 1.3 Released

USB Detect & Launch has been enhanced to allow you to execute a custom script from the system tray menu. The option appears only when you’ve inserted the USB device. The idea behind this is that after the initial insertion event you can fire an automatic script to perform an action, then before you eject it you can use the system tray menu to fire off another script.

To use this feature, simply add a line under your device called menurun. E.g.

label:PENDRIVE
exec:
“c:\win32app\startup\batch-insert-pendrive.cmd” %2
menurun:”c:\win32app\startup\batch-eject-pendrive.cmd” %2

One utility you might find useful to use in conjunction with your scripts is USBDeview. This will allow you to issue a ‘Safely Remove Hardware’ command from your script.

Click over to the software page for the download.

USB Detect & Launch Version 1.2 Released

This new version allows you to specify drives that USB Detect & Launch will ignore. This is useful if you need to improve performance on a PC where you’ve got devices (including mapped drives) that are slow to poll. It may also prevent sleeping drives from spinning up, although I haven’t tested this myself :-)

The ignore list is specified as a comma-separated list of drive letters, e.g.

ignore:d:\,e:\,g:\

Click over to the software page for the download.

New Versions of File Mover and USB Detect & Launch

Due to popular request, both File Mover, and USB Detect & Launch have been updated so that they minimise to the system tray.

Full Podcast Download Automation

In my last post I chose Juice (formally known as iPodder) to keep me up-to-date with the latest podcasts. It downloads the latest episodes and sticks them into a folder when they’re complete. Since this runs on my server I don’t know when the download is ready, and I also have to plug in my MP3 player and copy them over manually.

In an Ideal World…

Wouldn’t it be great if I was notified when the download had completed and could simply plug in my MP3 player and the PC copied over the files automatically? There didn’t seem to be anything out there that automated things to this degree so I decided to roll my own. Here’s what should happen:

  • Podcast app downloads new episodes from the RSS feeds I’m subscribed to
  • Podcast app should update my ‘completed downloads’ RSS feed with the latest podcast (this feed is read on my desktop at work). This is achieved through a simple script that’s executed when the download completes.
  • If the podcast app doesn’t support scripts and you’d like to reorganise the downloaded files or run a script, then use File Mover as an intermediate step.
  • Detect when a USB storage device is inserted
  • Based on the USB device’s label, run a specific script, which in this case will move .mp3’s to my MP3 player, and move video episodes of Diggnation & Hak5 to a USB memory stick so that I can get them on my laptop with the minimum of fuss.

Basic flow



The New Application

Detecting a USB storage device and running a specific script based on it’s label isn’t something I found an application for. That’s when wrote my own app to do exactly that.

Like with most of my utilities, the program is quite simple, with the power coming from being able to fire off a script which you can do almost anything with. In this case I’ll write a simple script to copy over any .mp3 files onto my appropriately labelled MP3 player, and anything else goes onto my 2GB USB stick.

The new app is called USB Detect & Launch and is available here for download. It’s effectively a beta, so give it a try and let me know whether it works for you!

Putting It All Together

1) Install Juice (or whatever app you’re going to use to subscribe to podcasts with)

2) Add the RSS feeds for the podcasts you want into Juice. E.g. Diggnation has them listed on the right hand side of the page, just pick the type of file you want (MP3, WMV, Xvid, etc).

3) Set up the destination folder for the downloaded podcasts

4) Set up the download schedule so that new podcasts are automatically downloaded

If you want to use RSS to inform you of newly downloaded podcasts follow the next steps, otherwise skip to step 8.

5) Write a quick script to add a few lines into our ‘completed downloads’ RSS feed so you’ll know when a new podcast is available even when you’re not near your server.

6) Add the script to Juice. Note; if you’re using another app that doesn’t support scripts in this way, then you can easily use File Mover as an intermediate step.

7) Setup your LAMP/WAMP installation to use a PHP script that will generate the RSS feed of completed downloads. The PHP script parses the logfile written by the script in step 5 and makes it into a simple feed.

Back to the automation…

8 ) Install and configure USB Detect & Launch. For each USB device you want to sync to, build up a simple script using the volume name, and the script you want to execute when the device is inserted.

e.g.

label:PENDRIVE
exec:wscript “c:\backup.bat” “%1” “%2”

label:CREATIVE300
exec:wscript “c:\batch\copy-to-mp3-player.bat” “%1” “%2”

%1 is replaced by the drive letter of the attached device (e.g. e:\)
%2 is replaced by the volume label of the attached device (e.g. PENDRIVE)

9) Write the script that’s called from USB Detect & Launch. The scripts can be as complex as you need them. A simple example would be to copy all the files from one of your podcast folders to your MP3 player using a batch script like this:

rem backup.bat
rem —————————————-
rem USB Detect & Launch will put the drive
rem letter of the USB storage device into %1
rem —————————————-

copy /Y “c:\podcasts\hak5\*.*” %1

Or maybe using xcopy to move all the sub-folders (/S) over would be better. Xcopy’s other options (/M) also allow you to copy over files with the Archive attribute and can reset this attribute after the copy.. essentially only copying the files over once, whilst keeping a copy on your hard drive:

xcopy f:\podcasts %1podcasts /M /S /Y

For more advanced copying of files, try using Robocopy with the Robocopy GUI app to help build up the command’s parameters.

Test The Setup…

10) That’s it. Start up Juice, and start USB Detect & Launch.

Test the process by subscribing to a new feed of podcasts. Let Juice download the latest episode automatically. When the download has completed you should find the file added to your RSS feed:

At this point you can insert your USB device and it should be detected & your podcasts will be copied over using the batch script you’ve written.

Simple 8)

Podcast Subscription Software

There are a whole host of podcasts that I download when a new episode is released. What I want to do is automate the process so that I don’t have to keep checking back for the latest ep. There is a fair amount of software out there that claims to do this, so I downloaded a fair number and looked for the following features:

  • Can be left unattended to just do it’s stuff
  • Accepts RSS feeds for subscriptions
  • Ability to download into a specific folder
  • Download the latest unseen episodes
  • Allow me to specify the episodes I don’t want
  • Schedule the downloads to happen at certain times
  • Minimum of clutter

Using a VirtualPC was ideal for evaluating each app; it allowed me to try each one without worrying about cluttering up my PC with stray registry entries and .dlls.

The ones I took a look at were RSS Radio, Nimiq, FireAnt, and Juice (formally known as iPodder). The one I liked most, for it’s simplicity and the fact it just works, is Juice which is Open Source and cross-platform.

Over the coming days I’ll play a bit more with it and see whether it lives up to my expectations! :-D

PC Virtualisation

Using a technology such as Microsoft’s VirtualPC is ideal for developers. In a nutshell, it allows you to run a virtual copy of Windows 98/2000/XP on your desktop.

In the screenshot below you’ll see my local copy of XP running a virtual copy of XP. The progress bar is showing a file being copied over to the desktop of the virtual PC after I dragged it in there from my PC.

For me, the benefits of using this type of software are:

– Older operating systems such as 98, NT4, and 2000 can be run without the need for multi-booting. This is great for testing your app works on legacy PCs.

– You can work on your normal desktop and switch to the virtual PC as if it’s another windows app.

– Each virtual PC can be setup to discard changes when you’re shutting it down; this is ideal for trying out software in an environment you can reset to a pristine state afterwards.

– The virtual hard drive for each PC is kept in a single file on your proper PCs hard drive. This makes it very easy to backup, or copy onto another PC (OS license permitting).

– The VirtualPC software is completely free! (but it does require you to have the relevant OS licenses for each virtual PC you create).

All in all it’s a good piece of software to try, especially if you’re a developer who doesn’t have a host of PCs to use as a test suite.