From: Subbu on
Guys,
Thanks for the replies so far. I found out the way to accomplish this in
VBS.

1. you need to download Windows resource kit tools. This is freely
downloadable.

http://www.microsoft.com/Downloads/details.aspx?FamilyID=9d467a69-57ff-4ae7-96ee-b18c4790cffd&displaylang=en

Have a look at the help file also, in Allprograms-->windows resource kit
tools->Windows resource kit tools help.html

2. One of the tools in this took kit is, Setprinter.exe, spooler
configuration tool

3. Then I used the following code in VBS to achieve this.
Dim Wshshell, setpnra3, myprinter

Set Wshshell= CreateObject("WScript.Shell")
myprinter = "printer name"
setpnra3 = "setprinter " &_
"""" & myprinter & """" & " 2 " & """" & "pdevmode=dmpapersize=8" & """"
' size = 8 for A3, size 9 for A4 etc.

intRC = WshShell.Run(setpnra3, 0, TRUE)

if intRC <> 0 then
WScript.Echo "Error returned from Setting the Printer " & intRC
WScript.Quit
End If

4. Setprinter.exe can set printer settings to different levels. I have
used level "2" which has most of the printer settings, in pDevmode.
Remember, this sets "myprinter" to this new settings.

5. For the remote printers, if the access is denied, then you can not set
using this command. Work around to this is, Install the Remote pritner
locally, to a new local port( there is a procedure in Microsoft web site) and
then change the settings to this local printer. I have done this way, it
works fine.

6. Using this setprinter, you can set most of the printer settings(this is
not application based, will change the printer settings globally).
The following can be set:- in pdevmode
dmorientation = 1 (P) or 2 (L)
dmpapersize=9(a4), 8(a3)etc
dmcopies=1
dmdefaultsource=7
dmprintquality=600
dmcolor=1monochrome 2 color
dmduplex=1no.2 yes
dmyresolution=600
dmTToption=2 (True type fonts)
dmcollate=1 on 2 off
dmbitsperpel =4
dmICMmethod =1
dmICMintent=3
dmMediatype=1 plain

Hope this helps. If you have any issues, I will be glad to help, If I know.

regards



"Eric" wrote:

>
> "Alex K. Angelopoulos" <alex.k.angelopoulos(a)gmail.invalid> wrote in message
> news:uo4xSJyGKHA.4004(a)TK2MSFTNGP05.phx.gbl...
> > Unfortunately, that technique won't work. The Win32_PrinterConfiguration
> > properties are read-only. You can set the PaperSize value because you're
> > not dealing with the PrinterConfiguration itself, but with a cached value
> > collection.
> >
> You can do something like that in VB
> (http://forums.devx.com/archive/index.php/t-65710.html).
> I remember setting the printer orientation in my own VB program and finding
> something of an object with read only properties I had to work around. Does
> VBScript have something similar?
>
>
>