Solved

Setting printer attributes from VB Script

Posted on 2009-04-07
1
976 Views
Last Modified: 2012-05-06
We have a VBS script that does most of the setup for an application.  

We have a Generic / text only printer installed, I am looking for a way for the VBS script to change the form to tray assignments to Envelope#10 and in Printer Commands to set Begin and End print job commands.

I can do all this manually, but am looking to script it so users can make the changes themselves.

Thanks in advance.
0
Comment
Question by:JohnAR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 3

Accepted Solution

by:
JohnAR earned 0 total points
ID: 24215619

After some digging around I found that you cant directly set individual settings from VBS (or other)

I manually made the changes I needed, then using the following code I can read these settings into an array, to apply them it just a metter of using SetBinaryValue and passing the array


Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
 
strKeyPath = "SOFTWARE\Microsoft\Windows NT\CurrentVersion\Print\Printers\Generic / Text Only\PrinterDriverData"
strValueName = "TTY DeviceConfig"
 
oReg.GetBinaryValue HKEY_LOCAL_MACHINE,strKeyPath,strValueName,arrValues
 
count = 0
 
wstmp = "PrinterDeviceConfig=array("
For Each strValue In arrValues
 
	if count = 0 then  wstmp = wstmp & strValue 
	if count <> 0 then  wstmp = wstmp & "," & strValue 
 
	count = count + 1
Next
 
wstmp = wstmp & ")" 
Wscript.Echo "Array " & wstmp

Open in new window

0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

While rebooting windows server 2003 server , it's showing "active directory rebuilding indices please wait" at startup. It took a little while for this process to complete and once we logged on not all the services were started so another reboot is …
There are many software programs on offer that will claim to magically speed up your computer. The best advice I can give you is to avoid them like the plague, because they will often cause far more problems than they solve. Try some of these "do it…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question