Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2366
  • Last Modified:

VBscript syntax check


Is it possile to do a syntax check on a VBscripts ".vbs". I want to be able to check for syntax errors before actaually executing the script.
I know that scripts don't get compiled, so how would you check for syntax problems?  I guess you need some sort of an interpreter?

I don't want to use the script debugger, becuase it will execute the script, right?.  Even though you have the option of stepping through and putting break points....etc, the script will execute.

Before intsalling the script (which does office automation), I want to make sure that it doesn't crash because there is an "If" that does not have and "end if" as an example.

Don't worry I am exeperimenting with an offline machine, so I can not potentially cause damage!!

Sounds simple, but I am a newbie to scripting.

Thanks

0
novice12
Asked:
novice12
3 Solutions
 
willcode4coffeeCommented:
You can run it and if it encounters any compile errors it will display the error in a message box. FrontPage may let you precompile and see errors that occur during the compile, but I am not sure about that.

M@
0
 
novice12Author Commented:

You are telling me that I have to run it, in order for it to do the error check in general.

Not very practical if I have a code consisting of hundreds of lines!. I just don't want to install it until I at least know there is no sytax errors.

I guess there is no way to do this!.

Thanks
0
 
scarcasCommented:
You could always try VBLaw - it's a commercial product available from http://www.visibleprogress.com/ - we use it in the office to great effect.  The Single user Workstation edition costs less than $100.

I'm unsure whether you can download an evaluation
0
 
harnalCommented:
There is basicly two ways to debug your code.  1 run the script and fix any errors it reports, 2 recheck each line for errors.  Obviously the first is the fastest and most through.  Why would you NOT want to run the script through the script debugger?  

You said its on a test & dev machine, I'm not sure why it's line count has anything to do with debugigng it using a script debugger.  It will only report errors, and the errors code and associated line number.  Very practical and efficient IMO.

Even if you don't have any syntax errors, you may find you have logic errors, or input/output errors that cause inconsistent or incorrect data.  And the only way you're going to discover that is to run the script.
0
 
novice12Author Commented:

Oops!!
Sorry about that, I think I have asked a silly question!

When I said that the line count is high, I was trying to say that it would take some time to review the syntax manually. But you are right it's irrelevant.

I will just run the script in debug mode, after making sure that the machine is completely isolated from the network. I will get errors on network drives mapping (part of the script), but I can skip through using the debugger....


Thanks
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now