Printer Commands

I need to put the following initialiazation string in the "Begin Print Job" field as per attachment.

<1B>%-12345X@PJL<20>ENTER<20>LANGUAGE=POSTSCRIPT<0A01>M%PS-Adobe<0A>(LexForm)run<20>Bs<0A20>

I already have a little script to do the separator page. How can I modify it

strComputer = "??????print02"
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters =  objWMIService.ExecQuery("Select * from Win32_Printer")

For Each objPrinter in colInstalledPrinters
      ObjPrinter.SeparatorFile = "\\aupriprint02\lexform\lexform.sep"
      objPrinter.Put_
Next

Wscript.echo "Done"
Printer.bmp
Bianchi928Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

aikimarkCommented:
Have you looked at the objPrinter properties?  Is there a property that can be associated with the Begin Print Job data?  If so, then assign your string to that property.
0
Bianchi928Author Commented:
Hi,

I've already done all of that and there wasn't any, hence my question.

Cheers
0
aikimarkCommented:
Have you tried SendKeys?
0
HTML5 and CSS3 Fundamentals

Build a website from the ground up by first learning the fundamentals of HTML5 and CSS3, the two popular programming languages used to present content online. HTML deals with fonts, colors, graphics, and hyperlinks, while CSS describes how HTML elements are to be displayed.

Bianchi928Author Commented:
No never..Can you please eleborate on how to ? Thanks
0
aikimarkCommented:
Here is a link to an EE article/tutorial (in Jscript):
http://www.experts-exchange.com/Programming/System/Windows__Programming/A_2449-Using-SendKeys-to-Automate-Repetitive-Tasks.html

Basically, you use the AppActivate and SendKeys methods of a Wscript.Shell object.

Your job is made a bit easier, since, you can use Alt+J ("%J") key combination to set focus to the Begin Print Job textbox control.
0
Bianchi928Author Commented:
Hi there !!

You're definitely on the right track. I need a kick start . Just give me a few start lines for my VBscript on how to AppActivate the "Begin Print Job" box. I think I understand how to send the keys then.

Thanks heaps
0
aikimarkCommented:
Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "U119c2-CostartDocuments Properties"
WshShell.SendKeys "%J"
WshShell.SendKeys "<1B>%-12345X@PJL<20>ENTER<20>LANGUAGE=POSTSCRIPT<0A01>M%PS-Adobe<0A>(LexForm)run<20>Bs<0A20>"

Open in new window

0
Bianchi928Author Commented:
Okay..I can see what you mean now. How does "%J" related to "Begin Print Job". I ran the little script you gave me and nothign is written to "Begin Print Job".

Thanks
Cheers
0
Bianchi928Author Commented:
I tried the following  - no sucess

Set WshShell = CreateObject("WScript.Shell")
WshShell.AppActivate "Printers and Faxes"
Wscript.sleep 100
WshShell.AppActivate "U119c2-CostartDocuments"
Wscript.sleep 100
WshShell.AppActivate "U119c2-CostartDocuments Properties"
Wscript.sleep 100
WshShell.AppActivate "Printer Commands"
Wscript.sleep 100
WshShell.SendKeys "%J"
WshShell.SendKeys "<1B>%-12345X@PJL<20>ENTER<20>LANGUAGE=POSTSCRIPT<0A01>M%PS-Adobe<0A>(LexForm)run<20>Bs<0A20>"
0
aikimarkCommented:
The %J string is the equivalent to you pressing Alt+J at the dialog.  It should set focus to the textbox to the right of the Begin Print Job label.

Why are there so many AppActivate methods being invoked?  The activation of the dialog must immediately precede any SendKeys methods.

What do you see when my script ran?

What causes your dialog box to appear?
0
Bianchi928Author Commented:
Okay..I have a script called zzz.vbs which contains (your code) and I've copied it on to the printer server . There's a printer called U119c2-CostartDocuments. When I ran your script, I can see wscript running in Task Manager. It doesn't come with any error at all. When I check
U119c2-CostartDocuments Properties, Printer Commands, Begin Print Job, there's nothing in this field.



Cheers
0
aikimarkCommented:
How do you open the properties dialog window?

My code assumes this dialog window is open.
0
Bianchi928Author Commented:
Usually , I will just right click on U119c2-CostartDocuments.
0
Bianchi928Author Commented:
and select Properties
0
aikimarkCommented:
What happens when you run the script after opening the dialog window?
0
Bianchi928Author Commented:
Select U119C2-CostarDocuments

I right click the Properties, Click Printer Commands and the Begin Print Job box is focussesd
Ran the script , nothing happens.
0
aikimarkCommented:
If you are on the correct tab, does pressing Alt+J set the focus on the correct textbox?
0
Bianchi928Author Commented:
I've done that too and still nothing.
0
aikimarkCommented:
>>still nothing
Does that mean that if the cursor is in another textbox on that dialog tab, it will not change focus to the Begin Print Job textbox?

If we can't get the sendkeys to work, the only other solution path I can think of is to look at the registry as a place where these strings are stored.
0
Bianchi928Author Commented:
I even tried that..Have the the focus to another field and then using ALT J. It does focus back to Begin Print Job. I alkso checked and there's any registry entried for that.

Cheers
0
aikimarkCommented:
What kind of device is this?
0
Bianchi928Author Commented:
Anyway, I've already cut and paste the init strings for all the printers. It had to be done urgently.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Bianchi928Author Commented:
That's the only way I could fix the problem
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.