Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning an error code on WScript.Quit

Status
Not open for further replies.

ChrisQuick

Programmer
Oct 4, 1999
144
US
I have an asp page that uses WSH to run a vbs file named "main.vbs".
This in turn runs additional vbs files including one named "groups.vbs".
I am trying to get the "groups.vbs" to return an error code on exit back to the main and display it, but the response always comes back as a zero.

Any thoughts about what might be wrong??

Here is the relevant code from main:
Set objWshShell = WScript.CreateObject("WScript.Shell")
strWshCommand = "d:\vbs\getgroups.vbs " & intUserID & " " & intMessageID
strWshResponse = objWshShell.Run(strWshCommand, True)
objWshShell.LogEvent 1, "The response was: " & strWshResponse


Here is the code from groups:
' I am passing the wrong number of args on purpose..
If WScript.Arguments.Count <> 3 Then
objWshShell.LogEvent 1, &quot;An invalid number of parameters was passed to the groups vbs file.&quot;
Wscript.Quit 1
Else
'tons and tons of code
End If cquick@callingpost.com
Geographic Information System (GIS), ASP, some Oracle
 
a clue that may work (I didn't try) : did you try to use the following :
Code:
    err.raise (666, &quot;An invalid number of parameters was passed to the groups vbs file.&quot;)
in replacement of
Code:
    objWshShell.LogEvent 1, &quot;An invalid number of parameters was passed to the groups vbs file.&quot; 
    Wscript.Quit 1

I hope that'll work.

P.S. Can you tell me how you did to run a VBS (groups.vbs) from another one (main.vbs) ? Water is not bad as soon as it stays out human body ;-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top