Solved

Setting printer attributes from VB Script

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

Too many email signature changes to deal with?

Are you constantly being asked to update your organization's email signatures? Do they take up too much of your time? Wouldn't you love to be able to manage all signatures from one central location, easily design them and deploy them quickly to users. Well, you can!

Join & Write a Comment

Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
Sometimes drives fill up and we don't know why.  If you don't understand the best way to use the tools available, you may end up being stumped as to why your drive says it's not full when you have no space left!  Here's how you can find out...
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
The Task Scheduler is a powerful tool that is built into Windows. It allows you to schedule tasks (actions) on a recurring basis, such as hourly, daily, weekly, monthly, at log on, at startup, on idle, etc. This video Micro Tutorial is a brief intro…

747 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now