Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - Re: How to display a variable value in a dialog box and how to read user input?

Reply
 
Old 06-20-2008   #1 (permalink)
Richard Mueller [MVP]


 
 

Re: How to display a variable value in a dialog box and how to read user input?

Tony wrote:
Quote:

> Sorry for this newbie question, but how do I display a variable value from
> a *.vbs script
> in a dialog box and - secondly - how to read a user input from a dialog
> entry field
> into a *.vbs script variable?
>
You can use the MsgBox function to display anything. You can concatenate the
value of a variable into a string to display. For example:
====
strValue = "Error"
strMessage = "Value of variable strValue: " & strValue & "."
Call MsgBox(strMessage, vbOKOnly + vbInformation, "My Script Title")
=========
Look up the MsgBox function in vbscript help. I run most scripts at a
command prompt using cscript. The MsgBox function pops up a box with the
message, but you can also echo to the command line with Wscript.Echo
statements. For example:
========
strValue = "Error"
strMessage = "Value of variable strValue: " & strValue & "."
Wscript.Echo strMessage
=======
To get input from the user, use the InputBox function. For example:
=====
strValue = InputBox("Enter a value", "My Script Title")
Wscript.Echo "The user entered the value: " & strValue
========
Again, check the help files for more syntax help, or search on "MsgBox" and
"InputBox".

--
Richard Mueller
MVP Directory Services
Hilltop Lab - http://www.rlmueller.net
--



My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
read strings to variable VB Script
How to read a user input value from command line and store it in a variable? VB Script
Re: How to display a variable value in a dialog box and how to readuser input? VB Script
Missing manual recipient input fields in send dialog? Vista print fax & scan
Read-Host issue, won't store to variable when using multiple read-host lines PowerShell


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46