views:

503

answers:

5

Any good utilities out there for verifying VBScript syntax without actually running the script?

What I'm getting at is if I do something like:

If (year == "2005" && type == 1) Then
...
End If

Is there a tool that will tell me that the '&&' really should be 'And' and the '==', just '='?

A: 

I love notepad++

Jon
That being more of a syntax highlighter, not a syntax checker. Unless there's some way to verify syntax with it...
scottmarlowe
+1 for Notepad++
ssorrrell
A: 

Visual Studio (2005 for sure) will do syntax highlighting and give you IntelliSense for registered dlls, which gets you awfully close to verified syntax.

Other than that, it's an interpreted language so there's only so much you can do. Even the best case scenario only guarantees an "it works on my machine" state.

Austin Salonen
A: 

i do not think theres any converter available unfortunately but considering that vbscript syntax is fairly easy you probably can convert it fairly easily

Lil'Monkey
+1  A: 

Actually, I think there is a way. The Script Control includes an Execute method similar to HTML VBScript's Eval method. You can give it a string and it will syntax check it.

You can still get it from here. http://www.microsoft.com/downloads/details.aspx?FamilyID=d7e31492-2595-49e6-8c02-1426fec693ac&displaylang=en

This old MSDN article describes how to add Scripting to your Apps. http://msdn.microsoft.com/en-us/magazine/cc302278.aspx

MSDN Article on the Script Control http://msdn.microsoft.com/en-us/library/aa227633(VS.60).aspx

Something like this.. (not sure of the instantiation)

Dim ScriptControl1 as New MSScript
ScriptControl1.ExecuteStatement “If (year == "2005" && type == 1) Then..End If”
ssorrrell
I'll have to give that a shot. thanks.
scottmarlowe
A: 

I'm looking for the same thing. If you happen to be working with vbscript in the context of asp, there is something called http://aspclassiccompiler.codeplex.com/ which apparently compiles your classic asp into asp.net.

Since I believe this gives some kind of compile time errors, I think syntax errors would be reported during compilation. Haven't tried it out yet though.

User