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
Solved

Setting printer attributes from VB Script

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

Portable, direct connect server access

The ATEN CV211 connects a laptop directly to any server allowing you instant access to perform data maintenance and local operations, for quick troubleshooting, updating, service and repair.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Logon script fails 23 45
Identify two keyboard codes and how to enter them 9 53
Need help Creating PowerShell Script 5 52
How to remove unneeded words from Notepad? 7 16
Join Greg Farro and Ethan Banks from Packet Pushers (http://packetpushers.net/podcast/podcasts/pq-show-93-smart-network-monitoring-paessler-sponsored/) and Greg Ross from Paessler (https://www.paessler.com/prtg) for a discussion about smart network …
When you try to share a printer , you may receive one of the following error messages. Error message when you use the Add Printer Wizard to share a printer: Windows could not share your printer. Operation could not be completed (Error 0x000006…
The viewer will learn how to successfully create a multiboot device using the SARDU utility on Windows 7. Start the SARDU utility: Change the image directory to wherever you store your ISOs, this will prevent you from having 2 copies of an ISO wit…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

792 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