Wrox Programmer Forums
|
BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions
This is the forum to discuss the Wrox book VBScript Programmer's Reference, 3rd Edition by Adrian Kingsley-Hughes, Kathie Kingsley-Hughes, Daniel Read; ISBN: 9780470168080
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: VBScript Programmer's Reference, 1st, 2nd, and 3rd editions section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 29th, 2005, 11:52 AM
Registered User
 
Join Date: Dec 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default Running Under Command Prompt

When I execute a .vbs file it always executes via the command prompt.

Is there a way to stop/modify this behavior?

Running XP Pro - Service Pak 2

Thanks,
Bill Slaughter
 
Old December 30th, 2005, 03:30 PM
Registered User
 
Join Date: Dec 2005
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Default

For Example:

The below script will not display the err in a windows dialog.

It is displayed in the command box and is only seen if I execute it from the command prompt.

If I click on the file name in windows explorer the command prompt box appears and disappears so quick that the result is lost.


Option Explicit

Dim x, y

x = InputBox("Please enter a number to divide into 100.")
If x <> 0 Then
    y = 100 / x
    MsgBox "100 divided by " & x & " is " & y & "."
Else
    Err.Raise vbObjectError + 15000, _
        "ERR_MSG_UGLY.VBS", _
        "Hey, stupid, you can't enter a zero. It will " & _
        "cause a divide by zero error."
End If

Why doesn't the windows dialog box appear as shown in the book?

Thanks.



Bill Slaughter
 
Old May 5th, 2009, 04:09 PM
Authorized User
 
Join Date: Apr 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I am new to VBScript Programming; thus, I am unfamiliar with VBScript Error Objects.

However, I think that you probably should use a MsgBox for your Error Message.

EXAMPLE:

Code:
 MsgBox Err.Raise vbObjectError + 15000, _
"ERR_MSG_UGLY.VBS", _
"Hey, stupid, you can't enter a zero. It will " & _
"cause a divide by zero error."





Similar Threads
Thread Thread Starter Forum Replies Last Post
command prompt karthisena BOOK: ASP.NET Website Programming Problem-Design-Solution 1 February 27th, 2007 04:11 AM
Command Prompt karthisena General .NET 2 January 25th, 2007 12:29 PM
Command Prompt joconnor PHP How-To 1 August 11th, 2004 06:29 AM
compiling from command prompt shakeelw BOOK: Professional C#, 2nd and 3rd Editions 2 July 13th, 2004 07:38 PM
VS.NET Command Prompt organicglenn BOOK: ASP.NET Website Programming Problem-Design-Solution 1 April 1st, 2004 02:39 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.