Topic: Help with VBScript |
|
---|---|
Author | Thread |
Paranoid (IV) Inmate From: under your rug, |
posted 09-12-2006 00:23
Sorry if this is the wrong forum, don't really see VBScript listed. code: Dim multiPrinter, PrinterLocation1, PrinterLocation2, PrinterLocation3, PrinterLocation4 PrinterLocation1 = "\\023netcdc1\023Lab1HP4200" PrinterLocation2 = "\\023netcdc1\023Lab2HP4200" PrinterLocation3 = "\\023netcdc1\023Lab3HP4050" PrinterLocation4 = "\\023netcdc1\023Lab4HP4200" Set multiPrinter = CreateObject("WScript.Network") multiPrinter.AddWindowsPrinterConnection PrinterLocation1 multiPrinter.AddWindowsPrinterConnection PrinterLocation2 multiPrinter.AddWindowsPrinterConnection PrinterLocation3 multiPrinter.AddwindowsPrinterConnection PrinterLocation4
|
Maniac (V) Inmate From: there...no..there..... |
posted 09-12-2006 22:40
I don't think that would be too hard to do. code: Dim objNet On Error Resume Next Set objNet = CreateObject("WScript.NetWork") Dim strInfo strInfo = objNet.ComputerName MsgBox strInfo 'Destroy the Object to free the Memory Set objNet = Nothing
code: strMyString = Mid(strMain, 8, 10)
code: strMyString = Mid(strInfo,4,4)
|
Paranoid (IV) Inmate From: under your rug, |
posted 09-14-2006 02:07
Thanks, just enough to get me where i wanted to be code: Dim objNet On Error Resume Next Set objNet = CreateObject("WScript.NetWork") Dim strInfo strInfo = objNet.ComputerName 'Destroy the Object to free the Memory Set objNet = Nothing strMyString = Mid(strMain, 8, 10) strMyString = Mid(strInfo,7,1) 'We are pulling the lab number from the computer name if strMyString = 1 then PrinterGO = "\\023netcdc1\023Lab1HP4200" msgbox "Lab 1 Printer Installed" elseif strMyString = 2 then PrinterGO = "\\023netcdc1\023Lab2HP4200" msgbox "Lab 2 Printer Installed" elseif strMyString = 3 then PrinterGO = "\\023netcdc1\023Lab3HP4050" msgbox "Lab 3 Printer Installed" elseif PstrMyString = 4 then PrinterGO = "\\023netcdc1\023Lab4HP4200" msgbox "Lab 4 Printer Installed" else msgbox "didn't work" end if 'Sets the printer based on the number pulled from previous function Set objPrinter = CreateObject("WScript.Network") objPrinter.AddWindowsPrinterConnection PrinterGO |
Maniac (V) Inmate From: there...no..there..... |
posted 09-14-2006 02:36
cool. glad it could help |