blog.jj5.net (2003 to 2005)

HKEY_CLASSES_ROOT\JSFile\Shell\Debug\Command

Mon Nov 8 21:19:00 UTC+1100 2004

Categories:

I decided that I wanted my shell context menu for *.js files to display both a Open (Run) and Debug option.

I modified HKEY_CLASSES_ROOT\JSFile\Shell\Open\Command to include the //D command line switch for wscript.exe, because it was giving me the shits that I couldn't attach a debugger to a script that was already running. No problems there.

I added a user tool entries (CTRL + 1, and CTRL + 2) to EditPlus to run/debug script files. No problems there.

I added HKEY_CLASSES_ROOT\JSFile\Shell\Debug\Command and set the default value to %SystemRoot%\System32\WScript.exe //X "%1" %* and the Debug menu item appeared, but when I selected it, I got an error.

It took me a while to figure out what was different. The difference was REG_SZ vs. REG_EXPAND_SZ. I'm guessing one is a fixed width string and the other is a null terminated string (or something like that). I could look it up if I cared.

So, I tried to change the type via regedit.exe, but regedit.exe doesn't allow you to modify the type of value, only the value's value.

So, I tried to delete the default value from regedit.exe, but regedit.exe doesn't let you delete the default value.

So, I ran regedt32.exe to change the value's type. But regdt32.exe doesn't let you change the value's type.

So, I deleted the default value via regedt32.exe (finally, something that I could do). Then I created a new value, with no name, and set its type as REG_EXPAND_SZ.

Now I have a 'Debug' option on my *.js files, that will give me the option of breaking into one of any of my registered debuggers (I have four).

Life is good.

God bless F11. :)

John.

p.s. I wonder if anyone knows if it's possible to get “Edit and Continue” like functionality via some debugger. I tried in VS.NET 2003 (and maybe also in the Microsoft Script Debugger (but I don't like that because it doesn't use F10/F11, but rather the other F8 business)) but the files are opened as read only. That's OK, but I think it would be dandy to be able to edit my scripts while I was running them...


Copyright © 2003-2005 John Elliot