Live syntax checking

This forum can be browsed by the general public. Posting is limited to current SAPIEN license holders with active maintenance and does not offer a response time guarantee.
Forum rules
DO NOT POST LICENSE NUMBERS, ACTIVATION KEYS OR ANY OTHER LICENSING INFORMATION IN THIS FORUM.
Only the original author and our tech personnel can reply to a topic that is created in this forum. If you find a topic that relates to an issue you are having, please create a new topic and reference the other in your post.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 17 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
User avatar
Russ Pitcher
Posts: 107
Last visit: Tue Jul 11, 2023 12:38 am

Live syntax checking

Post by Russ Pitcher »

Live syntax checking doesn't highlight undeclared variables as you had said it would. Is this something that needs to be turned on?

It would also be useful if the bad syntax highlight could give you a clue as to what is wrong with a tool-tip or a note in the debug/ouptut window for example.
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Live syntax checking

Post by Alexander Riedel »

There is a tooltip if the VBScript engine tells us what's wrong, just hover over the line with the underline.

As for undeclared variables, do you use option explicit in your scripts?

Alex
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Russ Pitcher
Posts: 107
Last visit: Tue Jul 11, 2023 12:38 am

Live syntax checking

Post by Russ Pitcher »

OK, I'll try it again and hover for longer.
I had option explicit enabled (it's in my vbscript template) but it's not the very first line in the script. I have some commented lines at the top to provide file info. does this make a difference?
Russ
User avatar
Alexander Riedel
Posts: 8478
Last visit: Tue Mar 26, 2024 8:52 am
Answers: 19
Been upvoted: 37 times

Live syntax checking

Post by Alexander Riedel »

Nope. I'll check on it.
Alexander Riedel
SAPIEN Technologies, Inc.
User avatar
Russ Pitcher
Posts: 107
Last visit: Tue Jul 11, 2023 12:38 am

Live syntax checking

Post by Russ Pitcher »

You were right about the tool-tip. It comes up pretty quickly on my home PC :-)
[I guess my work laptop's slower than I though :-( ]
Here's a simple script that doesn't show the undeclared variable.

'===========================' NAME : Example script' DATE : 15/11/2006'==========================Option Explicit
For variable = 1 To 5 WScript.Echo variableNext
This returns the error

D:Scripts!LibrarySavvisUntitled3.vbs(11, 1) Microsoft VBScript runtime error: Variable is undefined: 'variable'Exit code: 0 , 0000h
This topic is 17 years and 4 months old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.