I was trying to find the way to change the default printer and to verify that the default printer is indeed a correct one (one of many network printers in NT and in XP environment).
Have not been able to figure it out, so I would like to ask for help.
P.S. I found this, but it does not work because 'sp' won't display the printer windows in XP, and in NT, 'Send>DefaultPrinter' will only send the first character . . .
Set/Change the Default Printer
From: Marcus Tettmar [email protected]
Date: 22/08/00
//Enter the name of the printer you want to be
//the default on the next line
Let>DefaultPrinter=HP DeskJet 690C
Press CTRL
Press Esc
Release CTRL
Send>sp
WaitWindowOpen>Printers
Send>DefaultPrinter
Press ALT
Send>ff
Release ALT
WaitReady>0
CloseWindow>Printers
Default Printer
Moderators: JRL, Dorian (MJT support)
To the Mjtnet Support!
I am still looking for a way to change the default printer, especially in XP.
Anyone has an idea?
Thanks
Anyone has an idea?
Thanks
Hi,
This script demonstrates how to do it programatically with VBScript. This script displays a list of printers and asks you to enter the printer number which it then sets as the default. Note the SetDefaultPrinter method which takes the printer number.
VBSTART
Sub DefaultPrinter
Dim Text, Title, i, j, tmp, printer
Dim Network, oDevices
' Create a new Network object to access Network properties
Set Network = CreateObject("WScript.Network")
' Read all printers
Set oDevices = Network.EnumPrinterConnections
Text = "Available printers" & vbCRLF
For i = 0 To oDevices.Count-1 Step 2
j = i
Text = Text & (i / 2) & vbTab
Text = Text & oDevices(i) & vbTab & oDevices(i+1) & vbCRLF
Next
' Show all available printers and allow a user selection
tmp = InputBox (Text,"Set default printer",0)
printer = oDevices(tmp * 2) ' select printer name
' Set the default printer
Network.SetDefaultPrinter printer
MsgBox "Set Default printer to " & printer, _
vbOkonly + vbInformation, Title
Set Network = Nothing
End Sub
VBEND
VBRun>DefaultPrinter
This script demonstrates how to do it programatically with VBScript. This script displays a list of printers and asks you to enter the printer number which it then sets as the default. Note the SetDefaultPrinter method which takes the printer number.
VBSTART
Sub DefaultPrinter
Dim Text, Title, i, j, tmp, printer
Dim Network, oDevices
' Create a new Network object to access Network properties
Set Network = CreateObject("WScript.Network")
' Read all printers
Set oDevices = Network.EnumPrinterConnections
Text = "Available printers" & vbCRLF
For i = 0 To oDevices.Count-1 Step 2
j = i
Text = Text & (i / 2) & vbTab
Text = Text & oDevices(i) & vbTab & oDevices(i+1) & vbCRLF
Next
' Show all available printers and allow a user selection
tmp = InputBox (Text,"Set default printer",0)
printer = oDevices(tmp * 2) ' select printer name
' Set the default printer
Network.SetDefaultPrinter printer
MsgBox "Set Default printer to " & printer, _
vbOkonly + vbInformation, Title
Set Network = Nothing
End Sub
VBEND
VBRun>DefaultPrinter
MJT Net Support
[email protected]
[email protected]
That was a great script. Thanks.
The script, when run, prompt for manual selection.
However, I wish to be able to switch to another printer AUTOMATICALLY.
I tried by adding at the end of the script
WaitWindowOpen>Set Default printer
Send Character/Text>3
Press Enter
Press Enter
But of course that is not the right thing to do.
Please help.
Thanks
The script, when run, prompt for manual selection.
However, I wish to be able to switch to another printer AUTOMATICALLY.
I tried by adding at the end of the script
WaitWindowOpen>Set Default printer
Send Character/Text>3
Press Enter
Press Enter
But of course that is not the right thing to do.
Please help.
Thanks
Just change the following line:
tmp = InputBox (Text,"Set default printer",0)
To:
tmp = printer_number
set to whichever printer you want to be the default.
tmp = InputBox (Text,"Set default printer",0)
To:
tmp = printer_number
set to whichever printer you want to be the default.
MJT Net Support
[email protected]
[email protected]