• Welcome to Theos PowerBasic Museum 2017.

IWshNetwork.AddPrinterConnection Method

Started by José Roca, July 14, 2008, 08:35:58 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

José Roca



The following code uses the AddPrinterConnection method to connect a network printer to LPT1.

JScript


var WshNetwork = WScript.CreateObject("WScript.Network");
WshNetwork.AddPrinterConnection ("LPT1", "\\\\Server\\Print1");


VBScript


Set WshNetwork = WScript.CreateObject("WScript.Network")
WshNetwork.AddPrinterConnection "LPT1", "\\Server\Print1"


PowerBASIC


DIM pWshNet AS IWshNetwork
pWshNet = NEWCOM "WScript.Network"
pWshNet.AddPrinterConnection UCODE$("LPT1"), UCODE$("\\Server\Print1")