hi folks, i am new to vbscript. How do I debug vbscript script?
hi folks, i am new to vbscript. How do I debug vbscript script?
"Gene." <Gene@xxxxxx> wrote in message
news:2CD57DF0-ED12-4634-9D13-0A04002C56D0@xxxxxxHow new? What other languages have you debugged, and what tools have you
> hi folks, i am new to vbscript. How do I debug vbscript script?
used? Do you have a sample of the kinds of scripts you want to develop? What
scripting engine will you use (WSH, HTA, HTML, or...)?
/Al
Hi Al
i know i can execute cscript with //x option.
Is that possible to open the same script inside of Visual Studio and execute
it from there? if yes, how do i supply input parameters?
Gene.
"Al Dunbar" wrote:
>
> "Gene." <Gene@xxxxxx> wrote in message
> news:2CD57DF0-ED12-4634-9D13-0A04002C56D0@xxxxxx>
> > hi folks, i am new to vbscript. How do I debug vbscript script?
> How new? What other languages have you debugged, and what tools have you
> used? Do you have a sample of the kinds of scripts you want to develop? What
> scripting engine will you use (WSH, HTA, HTML, or...)?
>
> /Al
>
>
>
Running your script from the Command Prompt will give you error
messages with line #.
On Jul 14, 2:10*pm, Gene. <G...@xxxxxx> wrote:
> hi folks, i am new to vbscript. How do I debug vbscript script?
Gene. wrote:Aside from visual studio, there are two possibilities,
> hi folks, i am new to vbscript. How do I debug vbscript script?
albeit probably more crude than vs.
They are MSE (Microsoft Script Editor) and Microsoft
Script Debugger.
The MSE comes with earlier versions of ms office,
(like Ofc2k) and maybe even later versions too
(look for MSE.EXE on your system).
The microsoft script debugger is somewhat ancient,
and does not get a lot of respect from the denizens
of this ng. MSD can be found on the ms scripting
website.
If you do have mse, that is generally seen as better
than MSD.
You can find discussions about how to use them by
using google advanced group search, and searching
this ng.
http://groups.google.com/advanced_search
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)
"Gene." <Gene@xxxxxx> wrote in message
news:F090EE0D-076B-4761-BE7F-20F4C8D72DB8@xxxxxxIf that is your answer to my first question, you are new enough that we have
> Hi Al
>
> i know i can execute cscript with //x option.
no idea what you know about scripting and what you do not. And that makes it
difficult to know how best to answer your question.
How would you like it if I ignored your questions by asking more of my own?
> Is that possible to open the same script inside of Visual Studio and
> execute
> it from there? if yes, how do i supply input parameters?
;-)
/Al
> Gene.
>
> "Al Dunbar" wrote:
>
>>
>> "Gene." <Gene@xxxxxx> wrote in message
>> news:2CD57DF0-ED12-4634-9D13-0A04002C56D0@xxxxxx>>
>> > hi folks, i am new to vbscript. How do I debug vbscript script?
>> How new? What other languages have you debugged, and what tools have you
>> used? Do you have a sample of the kinds of scripts you want to develop?
>> What
>> scripting engine will you use (WSH, HTA, HTML, or...)?
>>
>> /Al
>>
>>
>>
"Gene." <Gene@xxxxxx> wrote in message
news:F090EE0D-076B-4761-BE7F-20F4C8D72DB8@xxxxxxAdd CScript.exe //X as an external tool and use propmt for arguments option.
> Hi Al
>
> i know i can execute cscript with //x option.
> Is that possible to open the same script inside of Visual Studio and
> execute
> it from there? if yes, how do i supply input parameters?
>
> Gene.
>
> "Al Dunbar" wrote:
>
>>
>> "Gene." <Gene@xxxxxx> wrote in message
>> news:2CD57DF0-ED12-4634-9D13-0A04002C56D0@xxxxxx>>
>> > hi folks, i am new to vbscript. How do I debug vbscript script?
>> How new? What other languages have you debugged, and what tools have you
>> used? Do you have a sample of the kinds of scripts you want to develop?
>> What
>> scripting engine will you use (WSH, HTA, HTML, or...)?
>>
>> /Al
>>
>>
--
Joe Fawcett (MVP - XML)
http://joe.fawcett.name
Gene. wrote:Gene, Although visual studio and the other debuggers
> hi folks, i am new to vbscript. How do I debug vbscript script?
(mse/mse7 and msd) may be fine, I must confess that
I have only rarely used them. What I mostly use is
"Brute Force" (or unsophisticated muddling-through).
As has been said already, if you simply run your
(attempt at a) script, then the script engine will
report any obvious "bugs" (errors) that it finds,
and tell you which line of your code to look for
the bug. This will get out any "syntax" (language)
bugs.
After that, you will be chasing logic errors. The
most fundamental way to do this is with msgboxes.
That is, if something is going wrong, put in a
msgbox to report on the variables. And if you
don't know WHERE things are going wrong, then
put in msgboxes periodically along the flow of
your script, to give yourself a periodic report
on things.
The scripting languages are pretty simple and
straight-forward. You can probably find most
bugs by simply examining the code. If something
is especially "sticky" (or resistant to debugging),
then you can ask about it here.
For my own debugging, I like to emulate the vb
"immediate" window pane, where you can write
progress messages using the vb "debug.print"
statement. wsh scripting doesn't have this
capability built in, but you can make one up using
a listbox control displayed on an hta, or one of
the other (non-ms) scripting gui interfaces.
cheers, jw
____________________________________________________________
You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)
"mr_unreliable" <kindlyReplyToNewsgroup@xxxxxx> wrote in message
news:%23%23$xgv06IHA.2260@xxxxxxThis is, indeed, the way a lot of debugging is done. The trick is to write
> Gene. wrote:>
>> hi folks, i am new to vbscript. How do I debug vbscript script?
> Gene, Although visual studio and the other debuggers
> (mse/mse7 and msd) may be fine, I must confess that
> I have only rarely used them. What I mostly use is
> "Brute Force" (or unsophisticated muddling-through).
>
> As has been said already, if you simply run your
> (attempt at a) script, then the script engine will
> report any obvious "bugs" (errors) that it finds,
> and tell you which line of your code to look for
> the bug. This will get out any "syntax" (language)
> bugs.
>
> After that, you will be chasing logic errors. The
> most fundamental way to do this is with msgboxes.
> That is, if something is going wrong, put in a
> msgbox to report on the variables. And if you
> don't know WHERE things are going wrong, then
> put in msgboxes periodically along the flow of
> your script, to give yourself a periodic report
> on things.
code that is, up front, easier to debug...
There's the rub, as a lot of poorly written script is similarly difficult to
> The scripting languages are pretty simple and
> straight-forward. You can probably find most
> bugs by simply examining the code.
read and/or understand.
So, how do you make code more debuggable? Here are some key points:
- keep the logic simple, and resist the temptation to use tricks and
incidental side effects to accomplish things, as these will get in your way
when they do not work.
- use structured programming concepts and forms.
- write code in a modular form. This allows you to debug individuals
modules, whether subs, functions, classes, or combinations of them, so that
they are known to be reliable. Then you debug at a higher level, namely how
they fit together.
- more on modularity: move your main-line script code into a subroutine;
avoid the use of global variables as much as possible; and keep the number
of inter-module interactions and dependencies to a minimum.
- use a variable/module naming scheme that reflects the meaning or use of
the variable; don't re-use existing variables for other purposes; include
comments that explain what is being accomplished, not how - the how is given
by the code, i.e.:
' add one to the index
index = index + 1
the above comment could have been written by a robot - do it this way
instead:
' advance to the next element of the collection
index = index + 1
Yes, by all means, yes.
> If something
> is especially "sticky" (or resistant to debugging),
> then you can ask about it here.
/Al
> For my own debugging, I like to emulate the vb
> "immediate" window pane, where you can write
> progress messages using the vb "debug.print"
> statement. wsh scripting doesn't have this
> capability built in, but you can make one up using
> a listbox control displayed on an hta, or one of
> the other (non-ms) scripting gui interfaces.
>
> cheers, jw
> ____________________________________________________________
>
> You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
> the answers will be applicable to the questions)
>
>
| Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| are VBscript on Windows server 2003 and VBscript on WS2008 compatible? | Francois Lafont | VB Script | 9 | 26 Apr 2010 |
| Can a vbscript identify the program/process that called a vbscript | MarceepooNu | VB Script | 15 | 16 Mar 2010 |
| VBScript Debug | Alan Gillott | VB Script | 6 | 25 Mar 2009 |
| How to debug a vbscript/ show each line BEFORE execution and with var values? | Tony Bansten | VB Script | 6 | 24 Mar 2009 |
| How to do No hang up VBScript (nohup for VBScript) | gimme_this_gimme_that | VB Script | 3 | 28 Oct 2008 |