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

WSH Debugging

30 views
Skip to first unread message

Dorel

unread,
Apr 16, 2001, 3:51:34 PM4/16/01
to
I've installed Microsoft Script Debugger 1.0a on a Windows 2000 machine and
hoped to use it for scripts written in Jscript, but the debugger works only
on HTML pages.
To use a script in HTML pages I need to make minor modifications to it, like
replacing "WScript.CreateObject()" with "new ActiveXObject()", and then it
seems that I can't use the WScript object (like WScript.Echo).
How can I use the debugger without having to save the script as a HTML page?
(I'm using Jscript 5.5 with WSH 2.0 and Debugger 1.0a).
Thanks.


Michael Harris

unread,
Apr 16, 2001, 3:06:35 PM4/16/01
to
In IE hosted script, just use window.alert() or confirm() or prompt().

To debug standalone (WSH hosted) script...

In WSH 2.0, set HKCU\Software\Microsoft\Windows Script\Settings\JITDebug = to 1 (DWORD value). Then
start your script with "wscript //d yourscript.vbs " to allow the "stop" statement to be honored. Or
use the syntax "wscript //x yourscript.vbs " to start the script in the debugger (no stop statement
needed).

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Dorel" <sil...@bezeqint.net> wrote in message news:3adb...@news.bezeqint.net...

John Zullo

unread,
Apr 16, 2001, 4:02:46 PM4/16/01
to
That did the trick! Thanks

"Michael Harris" <Please....@To.NewsGroup> wrote in message
news:uPeoehqxAHA.2252@tkmsftngp02...

Shannon

unread,
Apr 16, 2001, 6:30:59 PM4/16/01
to
are you debugging the js/vbs file as well as the wsc?

"John Zullo" <jo...@gmsint.com> wrote in message
news:ePpoqBrxAHA.572@tkmsftngp05...


> That did the trick! Thanks
>
> "Michael Harris" <Please....@To.NewsGroup> wrote in message
> news:uPeoehqxAHA.2252@tkmsftngp02...
> > In IE hosted script, just use window.alert() or confirm() or prompt().
> >
> > To debug standalone (WSH hosted) script...
> >
> > In WSH 2.0, set HKCU\Software\Microsoft\Windows Script\Settings\JITDebug
=
> to 1 (DWORD value). Then

> > start your script with "wscript file://d yourscript.vbs " to allow the


"stop"
> statement to be honored. Or

> > use the syntax "wscript file://x yourscript.vbs " to start the script in

Michael Harris

unread,
Apr 16, 2001, 9:24:10 PM4/16/01
to
To debug a WSC, set the same JITDebug named value. You also need to add the

<?component debug="true" error="true"?> processing instruction to the WSC source file...

For a WSF file, add

<?component debug="true" error="true"?> processing instruction to the WSF source file...

The error attribute isn't strictly needed to debug, but it certainly helps ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Shannon" <sh...@envivid.com> wrote in message news:OHC6VVsxAHA.940@tkmsftngp02...

Shannon

unread,
Apr 17, 2001, 1:07:50 PM4/17/01
to
Michael,
Edited the registration value for the current local user, and edited my
component tag to be " <?component debug="true" error="true"?> ". Then
running from the command line wscript.exe c:\peoplepc\components\test.js and
put the debugger statements with the x in front of it, and I get an illegal
advise error.

My wsc file contents are as follows:

<?xml version="1.0" encoding="windows-1252"?>


<component debug="true" error="true"?>

<registration
description="This is the test for WSC"
progid="WSHTest"
version="1.00"
classid="{bb5c2477-c458-41c1-9d45-7c9d77efb004}">

<script language="VBScript">
<![CDATA[
Function register()
MsgBox "Component 'WSHTest' registered."
End Function
Function unregister()
MsgBox "Component 'WSHTest' unregistered."
End Function
]]>
</script>

</registration>

<public>
<method name="WSHTest"/>
</public>


<script language="jscript">
<![CDATA[

var description = new WSHTest;

function WSHTest()
{
return "test";
}

]]>
</script>

</component>
And then the javascript file that calls this guy has the following contents:
debugger;
WScript.Echo("This machine is running " + WScript.Name + ", version " +
WScript.Version);
var objNewCharger = WScript.CreateObject("BaddaBing");
WScript.Echo("-*-*-* Test *-*-*-");
var txtTmp = objNewCharger.WSHTest();
WScript.Echo(txtTmp);

"Michael Harris" <mik...@mvps.org> wrote in message
news:#qW9a0txAHA.1752@tkmsftngp04...

Shannon

unread,
Apr 17, 2001, 1:33:17 PM4/17/01
to
Nevermind Michael I got it, I realized that the " <?component debug="true"
error="true"?> ", statement doesn't replace the component start tag. After
that it worked great, thanks for the help once again. Many thanks at that.
Shannon

"Shannon" <sh...@envivid.com> wrote in message

news:em2bbF2xAHA.1332@tkmsftngp04...

Michael Harris

unread,
Apr 17, 2001, 3:20:04 PM4/17/01
to
And fix this...

<component>


<?component debug="true" error="true"?>

And take the time to read the documentation ;-)...

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Shannon" <sh...@envivid.com> wrote in message news:em2bbF2xAHA.1332@tkmsftngp04...

Michael Harris

unread,
Apr 17, 2001, 3:15:35 PM4/17/01
to
To start with, remove the line:

var description = new WSHTest;

--
Michael Harris
Microsoft.MVP.Scripting
--
mik...@mvps.org
Please do not email questions - post them to the newsgroup instead.
--

"Shannon" <sh...@envivid.com> wrote in message news:em2bbF2xAHA.1332@tkmsftngp04...

0 new messages