Check for arguments after users input
- From: "Reitze" <spammed.mail@xxxxxxxxx>
- Date: 21 Sep 2005 12:55:51 -0700
Hello all,
Im trying to create a vbs script that uses con2prt.exe to let
workstations create printer connections (and delete them). The reason
why I use this tool is because the users need to print local, but are
not allowed to save changes to there workstation (thinclients rollback
after restart). The script makes a .bat file on the home drive of the
user and starts this batch when he logs on. It works fine, but I want
to build in a error control when the user gives a wrong printer name.
The printers all start with PRT (PRT01 etc) and I want to create a
msgbox with the text "thats not a printer" when the user is not giving
the right words (PRT)in the inputbox. See the script below.
Thanks for anny input
Reitze
the script so far.............
Dim fso,file, printername, con2prt, arrInput, yesno, default
Set fso = CreateObject("SCRIPTING.FileSystemObject")
con2prt="con2prt.exe"
ask for the printername
Printername = InputBox("WHAT IS THE NAME OF THE
PRINTER:","Printername")
'here must come a error checking for the right words (prt*)
arrInput = Split(Printername, ",")
For count = 0 To UBound(arrInput)
'WScript arrInput(count)
'ask for if this is a default printer (/cd is default/connect and /c is
connect)
yesno = msgbox("Is this your default printer?", 4, "Default printer?")
if yesno = 6 then
default=" /cd" & " \\printserver\"
else
default=" /c" & " \\printserver\"
end if
'Write the batch
Set file = fso.OpenTextFile("c:\printer.bat", 8, True)
file.WriteLine con2prt & default & printername
file.Close
Set fso = Nothing
next
.
- Prev by Date: Re: Is there a Monad Roadmap?
- Next by Date: Re: Is there a Monad Roadmap?
- Previous by thread: Re: Monad Article at PDC
- Next by thread: need to create DNS records in AD via vbscript... can i?
- Index(es):
Relevant Pages
|