Page 1 of 4
Have you ever wished that your Internet Explorer browser's Home page could be different every day?
There are web pages that I like to see once a week, say, and for this a rotating home page facility would be really useful. In fact it turns out to be fairly simple to implement and the resulting system is easy to use and robust. All you need is VBScript or JScript and the only complication is that it relies on writing a number of scripts and making use of a number of different Windows subsystems.
It's a really good exercise in how you can piece a system together from a number of small components.
In this project we will learn how to:
- add a custom menu item to Internet Explorer
- work with the registry
- setup scheduled tasks using script
- create and edit URL shortcuts
- run command line utilities from script
- write scripts that access the user's Favorites
The grand plan
The aim is simple enough – change the browser's Home page to one of a given list at a regular interval.
There are various ways in which the idea could be elaborated. For example you could assign each home page to a day of the week or set dates that you want pages to open. In the spirit of keeping things simple the home page rotator will do just that – rotate through a list.
To achieve this we need to give the user some way of adding a page to the list and some way of triggering the event that changes the home page. After some thought I came up with the idea of adding a menu item to the right click context menu in Internet Explorer so that the user could add the current web page to the list of rotating home pages.
Adding a custom menu item to the context menu is a little-known technique but it's the easiest way to extend or customise Internet Explorer and well worth knowing.
Clearly the rotating home page list is going to be a list of URLs but where to store it? One solution is to add each URL to a special folder in the user's Favorites folder. This has the advantage that the rotating home pages just look like favourites and the user can add or edit them in the usual way. The only disadvantage is that we have to find a way to manipulate the Favorites folder in a script.
Once the list of URLs is built, an easy way to run a program on a regular basis without any real effort is to use the built in Windows scheduler. The only problem is that its programmable interface is horrible! It is much improved in Vista and Windows 7 but to make use of the new version 2.0 Task Scheduler would mean that the solution wouldn't work under XP.
An easier to solution, and one that works with all versions of Windows that support the Task Scheduler, is to use one of the command line utilities to set up the schedule. Again using a standard Windows facility to implement what is needed has the advantage that the user can modify what happens using the standard tools, i.e. the scheduler Wizard in this case.