| |
Soulshepard
Posts: 1
Score: 0
Joined: 8/1/2003
From: Netherlands
Status: offline
|
Made to get your dos apps printing made easy. suggestions allways welcome.. ---cut&paste--- option explicit 'This script will read the default printer installed on an 2000/XP workstation. 'then takes this value and makes a local lpt1 and 2 capture to that port. 'version 1.2 ' 'By : Soulshepard@hotmail.com ' 'supress errors ON ERROR RESUME NEXT 'preferences. ' dim WshNetwork, WshShell, arrPrn, strDescr, arrPort, strPort, strMsg, strPrn ' Connect to shell ' Set WshShell = WScript.CreateObject("WScript.Shell") ' Read printer info from registry ' strPrn = WshShell.RegRead("HKCU\Software\Microsoft\Windows NT\CurrentVersion\Windows\Device") ' Format printer info ' arrPrn = Split( strPrn, ",", -1, vbTextCompare ) strDescr = arrPrn(0) arrPort = Split( arrPrn(2), ":", -1, vbTextCompare ) strPort = arrPort(0) 'use the value resulted as the default printer for LPT1 and 2 ' Set WshNetwork = WScript.CreateObject("WScript.Network") WshNetwork.RemovePrinterConnection "LPT1" WshNetwork.RemovePrinterConnection "LPT2" WshNetwork.AddPrinterConnection "LPT1" , strDescr WshNetwork.AddPrinterConnection "LPT2" , strDescr ' In case of debug, Display the result ' 'strMsg = vbCrLf & "Default printer is " _ ' & strDescr & " on " & strPort 'WScript.Echo strMsg ---EOF---
|
|