Source language: Translate to:

Maybe a silly question but ...

Questions and information about using VBScript and JavaScript in NeoBook functions

Moderator: Neosoft Support

Maybe a silly question but ...

Postby cp4w » Sun Mar 01, 2009 8:52 am

I am trying to exit a vbs script early if an error is detected using Wscript.Quit but it does not work. the error I get is
"object required wscript"

If I use
WScript.Echo "xxx" I get an error
type mismatch for echo

But Wscript is available because this does work
Set WSHShell = CreateObject("WScript.Shell")

What is going on?
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby Neosoft Support » Mon Mar 02, 2009 11:53 am

Thanks to Microsoft, this is pretty confusing, but the website below takes a stab at explaining why you can't use WScript:

http://www.microsoft.com/technet/scriptcenter/funzone/puzzle/answers/jul2106.mspx
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby cp4w » Mon Mar 02, 2009 12:21 pm

Thanks for the reply.

My problem now is how can we leave the script (early termination)when an error condition occurs.
I don't think "exit" works, the only way I know is "Wscript.Quit" but that also doesn't work as the link you supplied would indicate.
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby Gaev » Mon Mar 02, 2009 12:46 pm

Steven:

If you post your current vbscript (with the non performing quit command) ... perhaps it can be restructured so ... under certain circumstances it drops to the physical end of the script ... where it will be terminated.
User avatar
Gaev
 
Posts: 3718
Joined: Fri Apr 01, 2005 7:48 am
Location: Toronto, Canada

Postby cp4w » Mon Mar 02, 2009 2:30 pm

Gaev, thanks for the offer. But I am not focusing on a particular script rather looking to understand what is available in coding these scripts.
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY

Postby Neosoft Support » Mon Mar 02, 2009 4:24 pm

Here's a link to Microsoft's VBScript User's Guide:

http://msdn.microsoft.com/en-us/library/t0aew7h6(VS.85).aspx
NeoSoft Support
Neosoft Support
NeoSoft Team
 
Posts: 5593
Joined: Thu Mar 31, 2005 10:48 pm
Location: Oregon, USA

Postby cp4w » Mon Mar 02, 2009 4:32 pm

thanks,
There is an exit sub command and I think that everything is suppose to be a sub routine.
cp4w
 
Posts: 533
Joined: Sun Apr 03, 2005 4:37 pm
Location: Great Neck, NY


Return to NeoBook Functions - VBScript & JavaScript

Who is online

Users browsing this forum: No registered users and 0 guests

cron