h1

The Daily Ringtone Wiz

January 28, 2009

Or how to get your Windows Mobile phone to use a different ringtone for each day of the week

Vista busy cursor The popular gadget podcast “The Daily Giz Wiz” is famed for its amusing themes and jingles, contributed by talented musicians who are fans of the show.  Regular listeners to the podcast, hosted by Leo Laporte and Dick DeBartolo, will know there are now separate themes for each day of the week, even Saturday and Sunday when the show is not actually on.

The themes are available for download and it struck me as a fun idea to use them for mobile phone ringtones.  Of course, I wanted to have the ringtone change daily to the correct theme for the day.

Picture by Sean Carruthers (by kind permission) – original on Flickr

You can change ringtones manually and for a while I did this every night at the same time as I was checking my alarm settings for the next morning.  It’s not exactly difficult but not very elegant either.

Really, you’d want the ringtone to change automatically.  Unfortunately, there is no facility for this on a Windows Mobile PDA-phone (I have the XDA Stellar which is O2’s rebrand of the HTC TyTN II) and probably no easier to implement on any other mobile platform.

I found myself off on a quest to sort this.  Not because it is important (it is after all just a silly whim) but it was a technological challenge and I don’t like to be beaten.

Suffice to say I found a solution, although I had to cut some code for the first time in years.  But having got there the solution is easy to implement and I am making my ringtone-switching program available for download.  Full instructions for implementing the solution are given below.

To the best of my knowledge this should work on any Windows Mobile phone, even fairly old ones.

Of course, you don’t have to use it with the Daily GizWiz themes.  You can use it with any 7 ringtones of your choice if you like the idea of a different ringtone for each day of the week.

Step 1 – Download the themes and the theme-switcher program

The files are available for download from drop.io/dailyringtone.

The login password is dickyde.

Download all the files to your computer then transfer them to the “My Documents” folder of your Windows Mobile phone (for example using ActiveSync or just opening your WM device in Windows Explorer).

The theme files are simply named for the days of the week: sunday.mp3, monday.mp3, etc.  There were actually two Saturday themes created, a Lueders and a Houghton version.  Dan Lueders‘s theme is funnier but Houghton’s makes for a far better ringtone so that’s the one I’ve included.

If you want to use non-GizWiz ringtones, just rename your chosen mp3 files to sunday.mp3, monday.mp3 etc and ensure they are saved in your phone’s My Documents folder.

The other file is my program, DailyRingTone.exe.  It also needs to go in the My Documents folder of your phone. Don’t trust me that it’s safe to download to your phone – please use your normal virus checker.

All the program does is get the current date/time from the system clock, extract the day of the week then update the ringtone setting in the Windows Registry accordingly.  That is, whenever this program runs it sets the ringtone to the mp3 file with the same name as the current day of the week.

Note that the program does not check that the mp3 file for the day of the week is present in the right folder, although if it isn’t all that happens is that the phone is set to use a default ringtone instead.  The program will run on any ARM processor, v4 or later.

You can test the program by finding it in your phone’s My Documents folder and “clicking” on it with your stylus.  The first time it runs you will need to give permission for it to run.  Do this now, so that the program will already be “authorised” when it runs automatically later under scheduler control.  Look in Settings > Phone and you will see that the ringtone has been changed to the correct day of the week.

Step 2 – Install a scheduler

You need a program to run DailyRingTone.exe every day for you.  There was no point my trying to code this.  There is a free commercial solution (if that isn’t a contradiction in terms).

For PDA-phone users (Pocket PC) you need CT Scheduler lite. Just download and install this in the normal way.  There is a different version for WM smartphones available from the same people, but I don’t have a WM smartphone to test my solution on.

Run the scheduler.  It is very simple to set up. Just add a new event and have it run the DailyRingTone.exe program every day at say 00:01.

And you’re done!

Note that the scheduler program needs to be kept running for the solution to work.  If you reboot your phone or close down the scheduler by mistake you will need to remember to restart CTSchedulerLite or your ringtone will not change automatically.

You can though arrange for the scheduler to restart automatically on a reboot. Find the program CTSchedulerLite in your phone’s Program Files\Connective Tools folder, copy it then “paste shortcut” into your phone’s Windows\Startup folder.

For anyone interested …

This is the main operative code for DailyRingTone.exe.  It may not be the most elegant bit of C++ code  ever written but it works.

SYSTEMTIME st;

unsigned short DayOfWeek;

HKEY hKey;

DWORD cb;

TCHAR sz0[] = _T(“\\My Documents\\sunday.mp3”);

TCHAR sz1[] = _T(“\\My Documents\\monday.mp3″);

TCHAR sz2[] = _T(“\\My Documents\\tuesday.mp3″);

TCHAR sz3[] = _T(“\\My Documents\\wednesday.mp3″);

TCHAR sz4[] = _T(“\\My Documents\\thursday.mp3″);

TCHAR sz5[] = _T(“\\My Documents\\friday.mp3″);

TCHAR sz6[] = _T(“\\My Documents\\saturday.mp3″);

GetSystemTime(&st);

DayOfWeek = st.wDayOfWeek;

//Sunday = 0, Monday = 1 … Saturday = 6

if (RegOpenKeyEx(HKEY_CURRENT_USER, _T(“ControlPanel\\Sounds\\RingTone0”), 0, KEY_READ, &hKey) == ERROR_SUCCESS){

switch(DayOfWeek)

{

case 0:

cb = (_tcslen(sz0) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz0, cb);

break;

case 1:

cb = (_tcslen(sz1) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz1, cb);

break;

case 2:

cb = (_tcslen(sz2) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz2, cb);

break;

case 3:

cb = (_tcslen(sz3) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz3, cb);

break;

case 4:

cb = (_tcslen(sz4) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz4, cb);

break;

case 5:

cb = (_tcslen(sz5) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz5, cb);

break;

case 6:

cb = (_tcslen(sz6) + 1) * sizeof(TCHAR);

RegSetValueEx(hKey, _T(“sound”), 0, REG_SZ, (const BYTE *)sz6, cb);

}

RegCloseKey(hKey);

}

I guess publishing the code makes this an open source (but unlicenced) project.

AddThis Social Bookmark Button

Advertisements

3 comments

  1. […] written some computer code to accomplish the feat, and published the full instructions on his site "Hasta la vista, Vista!" (or snipurl.com/dailyringtone), including the program and theme files.  Now Dick is ready to […]


  2. STOP PRESS: I found a bug in my code. Now fixed. Read this post and, in particular, the comments.


  3. The only downside is that some of the themes are a bit embarrassing in polite company, particularly at the office and very particularly on Thursdays.



Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: