Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to set paper tray and paper type in wsh script

542 views
Skip to first unread message

Repent

unread,
Mar 2, 2009, 5:50:42 PM3/2/09
to
I have the following vbs script setup to run for each user. What
commands are needed to set paper tray and paper type in the code?

Set WshNetwork = CreateObject("WScript.Network")

WshNetwork.AddWindowsPrinterConnection "\\servername\HP4600c"

WshNetwork.AddWindowsPrinterConnection"\\servername\Ricoh1232c"

WshNetwork.AddWindowsPrinterConnection"\\servername\DELL5100cn"

WshNetwork.SetDefaultPrinter "\\servername\Dell5100cn"

Al Dunbar

unread,
Mar 3, 2009, 4:53:55 PM3/3/09
to

"Repent" <repe...@hotmail.com> wrote in message
news:ufooq414oq70he5g4...@4ax.com...

>I have the following vbs script setup to run for each user. What
> commands are needed to set paper tray and paper type in the code?

The WshNetwork object is fairly limited, and can basically only add and
remove printer connections, set the default printer, and install drivers (I
think). Setting the paper tray and type would seem to be one of the things
specific to the driver(s) involved. There might be a way to get at the
driver through WMI for some of these functions, but that is just a guess.

/Al

T Lavedas

unread,
Mar 3, 2009, 5:52:13 PM3/3/09
to
On Mar 3, 4:53 pm, "Al Dunbar" <aland...@hotmail.com> wrote:
> "Repent" <repen...@hotmail.com> wrote in message

Al,

You're right that WMI provides more information, but it does not
appear that it provides the stuff that the OP requested. My listing
of the printer characteristics available from WMI's
Win32_PrinterConfiguration class is as follows:

BitsPerPel
Caption
Collate
Color
Copies
Description
DeviceName
DisplayFlags
DisplayFrequency
DitherType
DriverVersion
Duplex
FormName
HorizontalResolution
ICMIntent
ICMMethod
LogPixels
MediaType
Name
Orientation
PaperLength
PaperSize
PaperWidth
PelsHeight
PelsWidth
PrintQuality
Scale
SettingID
SpecificationVersion
TTOption
VerticalResolution
XResolution
YResolution

I don't see anything like paper tray. I also didn't check to see if
any of these properties are read/write. I suspect that the write part
is probably not supported - at least, not for most of them.

It may be more likely to use one of the Office applications, such as
Word to access the print driver setting, though I didn't check or have
time to do it. Just a guess.

Tom Lavedas
***********
http://there.is.no.more/tglbatch/

mr_unreliable

unread,
Mar 4, 2009, 1:26:05 PM3/4/09
to
Repent wrote:
> I have the following vbs script setup to run for each user. What
> commands are needed to set paper tray and paper type in the code?
>

hi Repent,

As has already been said, your access to the various printer
properties via the usual script objects is severely limited.

Various parties (myself included) have "wrapped" the vb
printer object up into an actX object which is callable
from script. The vb printer object has just about everything
you might want to do, including get/set paper tray (although
vb calls this property the "PapaeBin").

For one version of a vb printer object wrapper, you can go
to Lee Peedin's REXX utilities page. I know what you're
thinking -- REXX ain't vbscript. O.K. it ain't, but Lee's
download is an actX dll, and is callable from vbscript.
In fact, he "advertised" it in this vbs ng:

http://groups.google.com/group/microsoft.public.scripting.vbscript/browse_thread/thread/bcdf594005eed2ea?q=rexx+printer+object+group:microsoft.public.scripting.vbscript#567fb716b968f3ad

To get the actual actX printer object, go to Lee's home page:

http://pragmaticlee.safedataisp.net/

and then skip down the page (past the mid-point), looking
for "PrinterObject2.zip", dated: April 26, 2005.

btw, if you don't like using a 3rd-party control, and if you
have a vb compiler ("classic", i.e., vb5 or vb6) you can write
a printer object wrapper for yourself. Just instantiate the
object, and pass it out through a public method.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but, no guarantee
the answers will be applicable to the questions)


p.s. a little request for help. I am aware that there is
a "complicated identifier" (a guid?) for the various newsgroup
postings, and a compact way to reference them (as opposed
to the lengthy reference (google url) of the sort I used above.

Can anybody explain how to get the newsgroup posting
reference number, and how to construct the compact way
of referencing a posting???

MadManBlues

unread,
May 4, 2009, 7:47:02 AM5/4/09
to
Hi,

In VB6 I can assign values for anyone of the object properties listed before,
but I cannot find a way to set the kind of paper.
I mean Glossy, Mate, Plain, Transparent film, ecc.
Can someone help me on this issue.
I create a form to associate the needed value to all properties of the
Printer object.
Is it possible that the only value I can set is the printQuality? I think
that the way in which
printer works should depend on paper type. Is this correct?

Thanks in advance
Kind regards

MadManBlues

unread,
May 4, 2009, 7:49:02 AM5/4/09
to
Hi Tom,
0 new messages