Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

debugging .wsf files for use under WSH

720 views
Skip to first unread message

Chazz

unread,
Feb 20, 2004, 9:16:10 PM2/20/04
to
I'm doing great with .vbs files (especially now that I found VbsEdit,
adersoft.com), but I'm interested in WSH scripts that use the .wsf file's
SRC element to include .vbs files with library code in them, and wsf files
don't debug with Windows Script Debugger (not even as used in VbsEdit).

How do you most easily write, edit, debug, and run .wsf files for WSH (not
other hosts)?

thanks,
Chazz


Michael Harris \(MVP\)

unread,
Feb 20, 2004, 10:14:36 PM2/20/04
to
> ... wsf files don't debug with Windows Script Debugger...

??? I have no problem debugging WSF scripts (using the src='...' on the
script element is irrelevant.

Of course I haven't used the old downloadable script debugger in years...

VStudio will debug script hosted via WSH.

Do you have any Office 2000 or Office XP apps?

To install the optional Microsoft Script Editor

--> Add/Remove programs, <your Office 2000/XP app>
--> change, add or remove features

then look under Office Tools -> HTML Source Editing -> Web Scripting.

MSE is actually a stripped down version of InterDev (even the same program
icon) and is a quite nice script debugger. I actually prefer it for script
since it loads faster thean the VStudio script debuggers.

With the Office XP version of MSE (MSE7.EXE), syntax coloring and
IntelliSense both work great right out of the box. It already knows about
js/vbs/wsf script extensions (I had to add the wsc extension manually).

You can also pass a file name via the command line when you start MSE7.EXE
and it will open the script in the editor (the mse.exe Office 2000 version
wouldn't accept a file name via the command line).

You can't start the debugger for WSH hosted script files via the Debug /
Start menu. But there is a 'View/Open With...' menu option. The Open With
dialog already had wscript.exe as an option.

You can add more 'View/Open With...' choices for:

wscript.exe //d --> which I named wscript (debug enabled)
wscript.exe //x --> which I named wscript (start in debugger)

and cscript.exe versions as well. The dialog complains (only a bit,
probably because of the switches) but lets you add them anyway.

What's really nice is that when you use these, you get a choice of debugging
in the current instance of MSE (where you're editing) or a new instance of
MSE or in any other available script debugger you may also have installed,
such as the various versions of VStudio.

--
Michael Harris
Microsoft.MVP.Scripting

Microsoft® Windows®2000 Scripting Guide
http://www.microsoft.com/technet/scriptcenter/scrguide/sagsas_overview.asp

TechNet Script Center Sample Scripts
http://www.microsoft.com/technet/scriptcenter/default.asp
Download in HTML Help format (searchable)
http://www.microsoft.com/downloads/release.asp?ReleaseID=38942

WSH 5.6 documentation download
http://www.microsoft.com/downloads/details.aspx?FamilyId=01592C48-207D-4BE1-8A76-1C4099D7BBB9&displaylang=en

name

unread,
Feb 21, 2004, 1:27:18 AM2/21/04
to
"Do you have any Office 2000 or Office XP apps?"

=========


It never passed the grade !


Office 4.03 and alias.


"Chazz" <ch...@chucksphar.com> wrote in message
news:KbzZb.24538$aH3.7...@bgtnsc04-news.ops.worldnet.att.net...

Al Dunbar [MS-MVP]

unread,
Feb 21, 2004, 1:31:25 AM2/21/04
to

"Chazz" <ch...@chucksphar.com> wrote in message
news:KbzZb.24538$aH3.7...@bgtnsc04-news.ops.worldnet.att.net...

I haven't tried Michael's suggestion, but will tomorrow.

I have been using PrimalScript from Sapien Technologies as an
editing/debugging tool. What I like most about this is the fact that the
editor looks after all of the details of the XML coding in the .WSF file,
allowing me to concentrate on the actual scripting. And, as a scripting
editor, it has the desired features like highlighting and intellisense.

The debugging facilities are somewhat minimal, but that suits me fine in
most cases. I generally sprinkle wscript.echo's around liberally when I run
into a problem, as this writes the output to a scrollable child window in
the editor. Even if a lot of "debug" output goes there I can find what I am
looking for with an editor search.

Most of my scripts run under wscript, so if I forget to remove the debugging
wscript.echo's, then I am rudely reminded when I try to run under wscript.

/Al


Michael Harris \(MVP\)

unread,
Feb 21, 2004, 1:07:43 PM2/21/04
to
> I have been using PrimalScript from Sapien Technologies as an
> editing/debugging tool. ...

Just an FYI...

PrimalScript itself does not include or install a script debugger. It
simply knows how to launch script with the right host swithces (//x //d) to
enable debugging. The actual debuggers are installed via MS products (I
don't know of any 3rd party, non-MS script debuggers). When prompted to
debug, I have 3 debugger choices - MSE, VS 6, and VS.Net).


--
Michael Harris
Microsoft.MVP.Scripting

Al Dunbar [MS-MVP]

unread,
Feb 21, 2004, 8:14:52 PM2/21/04
to

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message
news:OhbNbWK%23DHA...@TK2MSFTNGP11.phx.gbl...

I understand that, on its own, PS is not a *real* debugging tool. But it is
a heck of a lot better than editing script in notepad and then running it in
the normal manner. Nonetheless, one need not have a "debugger" to debug,
just the ability to find and identify bugs, then do something about it.


/Al


Chazz

unread,
Feb 24, 2004, 6:51:03 PM2/24/04
to
Thanks to all who replied. This gives me some things to try.
What I'm really focused on is pure WSH scripting--no IE, ASP, etc., with
VBScript. I'm also trying to hold down the cost, so I've been using VbsEdit
2.0 (Adersoft.com), which is excellent for .vbs files but not well suited to
.wsf files, which seem to confuse the devil out of the old Windows Script
Debugger (used in VbsEdit). So no PrimalScript, no VStudio, etc. So far I'd
had little luck doing WSH-type scripts in MSE. So let's see where I get to
now. Again, thanks.

Chazz

"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message

news:OhbNbWK#DHA....@TK2MSFTNGP11.phx.gbl...

Michael Harris \(MVP\)

unread,
Feb 24, 2004, 7:42:33 PM2/24/04
to
> <snip> So far I'd had little luck doing WSH-type scripts in

> MSE. So let's see where I get to now. Again, thanks.

What version of MSE (Office 2000 or Office XP)?

The Office 2000 version of MSE (MSE.EXE) needs some registry tweaks (and
*.wsf with real <script> elements or *.js or *.vbs with commented <script>
elements) to be useful as a standalone script editor.

Chazz

unread,
Mar 8, 2004, 8:50:22 PM3/8/04
to
Thanks very much, Michael, for the info you provided on MSE. I was able to
use most of it just as you described it. However, for some odd reason I
can't for the life of me open a .wsf file in MSE for editing, etc. Not from
MSE's File menu, not by munging the Registry key for wsffile so the Edit
command points to MSE, not nothin'. Also, MSE's Open dialog has only entries
for Text files and All Files--typing *.wsf in the Filename box does display
those files only, but opening a .wsf file executes the script instead of
setting it up for editing. Any thoughts? And how, by the way, did you add
the ability to open .wsc files from MSE?

thanks,


Chazz
"Michael Harris (MVP)" <mikhar at mvps dot org> wrote in message

news:#2rbDhz#DHA...@tk2msftngp13.phx.gbl...

Michael Harris \(MVP\)

unread,
Mar 8, 2004, 9:42:24 PM3/8/04
to
> ... However, for some

> odd reason I can't for the life of me open a .wsf file in MSE for
> editing, etc. Not from MSE's File menu, not by munging the Registry
> key for wsffile so the Edit command points to MSE, not nothin'. Also,
> MSE's Open dialog has only entries for Text files and All
> Files--typing *.wsf in the Filename box does display those files
> only, but opening a .wsf file executes the script instead of setting
> it up for editing. Any thoughts? And how, by the way, did you add the
> ability to open .wsc files from MSE?


I don't get any odd behavior opening *.wsf files using mse7.exe's normal
file open dialog. They open for editing and can be executed with the
'view/open with' wscript.exe same as any other script type...


--
Michael Harris
Microsoft.MVP.Scripting
Seattle WA US

Michael Harris \(MVP\)

unread,
Apr 16, 2004, 8:08:41 PM4/16/04
to
I suggest you re-post this as a new thread. It will get lost here as an off
topic reply on an unrelated thread.

--
Michael Harris
Microsoft.MVP.Scripting
Sammamish WA US

Lee Gray

unread,
May 4, 2004, 5:17:25 PM5/4/04
to
My MSE7 works fine out of the box for syntax coloring, but there's no
intellisense at all for .wsf files, and only some for .vbs files
(function calls and objects created with CreateObject).

Are there some tweaks I need to make for full support to work?

Thanks,
Lee

[to email please remove the dots from uop]

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

name

unread,
Jun 17, 2004, 1:43:27 AM6/17/04
to
You can peel an apple with a knife or a lawn mover.

A debugger/syntax highlighter is just a pair of
white cotton gloves.


"Lee Gray" <lee....@u.o.p.com> wrote in message
news:%239Jmz0h...@TK2MSFTNGP12.phx.gbl...

0 new messages