Programming: The Microsoft Script Editor

September 4, 2008

MSE EditorThe ‘Microsoft Script Editor’ (MSE) program is not a very well advertised application out of the suite of programs supplied in MS Office 2003.

Previously before I found about MSE’s existence, I used to code with an application called HTML-Kit to do my HTML and VBS application development. Although not a bad program, it had stability problems when saving files and would often trash the one I was working on.

MSE has got the following useful features;

  • IntelliSense code completion,
  • Good integration with script debugging in IE, Wscript and Cscript.

It unfortunately needs some configuration and registry editing to get the best out of it. Here is a collections of what I’ve found by googling about.

Installing (Finding) the MSE editor application

If you do a full install of MS Office 2003, you should find the application file at the following location. If not, run Office 2003 setup again and add ‘HTML Source Editing’ under the {Office Tools} installation category.

“C:\Program Files\Microsoft Office\OFFICE11\MSE7.EXE”

Best to make a short cut to this and place it on your desktop. Microsoft normally expects the user to start this application in MS Word {Tools/Macro/Microsoft Script Editor}. That’s dumb, it deserves its own link.

Enabling Just-In-Time debugging

In Internet Explorer (IE7) under {Tools/Internet Options/Advanced tab}, you can clear the checkbox under {browsing/Disable script debugging (Internet Explorer)}. It’s normally disabled by default to make life easier for web surfing where most users are not into debugging faulty things like:

IE Debug message

Though this may now drive you mad for your own IE web surfing. There is a solution for this – surf with Firefox instead 😉

In the MSE application, set {Tools/Options} as following.
Just-In-Time debugging options in MSE

When your application crashes at a faulting line, or code execution comes across a breakpoint that you have set through MSE, you’ll be placed back into the editor with the line highlighted in yellow. If you have programmed before in VB/VBA or similar, you’ll be familiar in what you can do here – single step, step over, watch variables – it’s a lifesaver 🙂

Debugging WSH and VBS scripts

The environment is set up by default to debug scripts running inside the Internet Explorer process. However, you can choose to use the wscript.exe and cscript.exe interpreters by selecting “view/open with” and adding those alternative choices to use instead.

For instance, add the command line ‘wscript.exe //x’ with a friendly name of ‘wscript (start in debugger)’ – and ‘open’ the application from this dialog rather than clicking the run button on the toolbar (which targets IE).

Finding more information

There are lots of other websites and blogs about this tool. Here is one

Projects: SlimServer ‘Server Power Control’ Plugin

September 4, 2008

The following code is for slimserver 6.5.1 only. The new squeezebox server software is not supported by this code, however there are plugins written by others that provide the same functionality. This post is left here only for reference.

*** 7/10/10 – Check out the plugins section of the slimdevices forum, where Gordon Harris has taken on this project and improved it considerably! ***


Slim logo

My Slimdevices Slimserver runs on a old power hungry Pentium III 800 MHz which I prefer not to left running when I’m not using it. Shutting the thing down was either a trip into the garage, or a terminal server remote login via another networked computer (hopefully still running) to log it off!

the plugin
I have thus written a plugin to avoid this messing about. I know there are similar plugins about based on running batch files, or automated from inactivity timeouts – but I wanted something a little bit more direct 🙂

The Slimserver 6.5.1 code is for Windows machines and force closes other applications except Slimserver which is (hopefully) shutdown correctly. The Linux / Mac talented among you may suggest changes for those platforms.

Once installed, you will find a “Server Power Control” entry in the Squeezebox unit’s displayed plugins list. Clicking right, you have the choice of shutting down or restarting the server. Clicking right from here will do the selected action in 3 seconds (which also blanks the display) unless you navigate back. If a track is playing, it will remain playing from the players buffer – no big issue.

The perl module file ‘’ should be placed in Slimserver’s plugin directory, and Slimserver restarted.

Uses the Win32 API method, Win32::InitiateSystemShutdown

*** 7/10/10 – The following code is here only for reference. It will not work with current releases of Squeezebox Server. Please view the forum link at the top of this post! ***

Download the file here -> (4.5kB, GPL License).

Updated 24th April 2007

Slimserver 7 update / Win32

Here is the PowerCtrl plugin modified by Gordon Harris to work with Slimserver 7. Unzip the file into the server\Slim\Plugin folder. (The files need to end up in server\Slim\Plugin\PowerCtrl)

*** 7/10/10 – The following code is here only for reference. It will not work with current releases of Squeezebox Server. Please view the forum link at the top of this post! ***

Download the file here -> (2.7kB zip, GPL License).

Slimserver 7 update / Linux

And here is Gordon’s modifications which makes this plugin work with Slimserver 7 on linux. This version is linux only and won’t work with Win32.

Install the contents to /usr/local/slimserver/Plugins/PowerCtrl

Manually delete the /usr/local/slimserver/Cache/plugin-data.yaml file.

As root, add the slimserver user to the /etc/shutdown.allow file:
touch /etc/shutdown
echo “slimserver” >>/etc/shutdown

edit the /etc/sudoers file:
Comment out the line with: Defaults requiretty


%slimserver ALL=NOPASSWD:/sbin/shutdown -h now
%slimserver ALL=NOPASSWD:/sbin/shutdown -r now

restart slimserver and voilà!

*** 7/10/10 – The following code is here only for reference. It will not work with current releases of Squeezebox Server. Please view the forum link at the top of this post! ***

Download the file here -> (2.6kB zip, GPL License).

Programming: Missing WScript namespace?

September 30, 2007

Came across this on usenet. Copied here so I’ll not lose it!

“WScript is an object exposed by the WScript and CScript script hosts. Since the
Microsoft Script Control is a different host, it does not have that internal
method available to it.

You can work around that by adding the WScript namespace to a script control
instance, assuming that the original host creating the instance is itself a
WSH-hosted script.

If your script control is referenced as sc, then once you initialize it you can
add WScript using the native name using the Script Control’s AddObject method,
like this:

Sc.AddObject “WScript”, WScript