Solved

Setting printer attributes from VB Script

Posted on 2009-04-07
1
967 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
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

This is an article about Leadership and accepting and adapting to new challenges. It focuses mostly on upgrading to Windows 10.
Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
This Micro Tutorial will give you a basic overview of Windows DVD Burner through its features and interface. This will be demonstrated using Windows 7 operating system.
Windows 8 came with a dramatically different user interface known as Metro. Notably missing from that interface was a Start button and Start Menu. Microsoft responded to negative user feedback of the Metro interface, bringing back the Start button a…

786 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