Send Keystrokes With Vbscript
Can you send keystrokes with the vbscript for example to send a ctrl+p and enter
0
-
Shotaro Ito
★ BarTender Hero ★
Hi Ely,
VBScript has SendKeys Method - code below would open notepad, type some text and show print dialog (ctrl+p).
[code]
Set sh = WScript.CreateObject("WScript.Shell")
sh.Run "notepad.exe", 9
WScript.Sleep 1000 'wait a while to load notepad app'
sh.SendKeys "Hello World!"
sh.SendKeys "{ENTER}"
WScript.Sleep 100
sh.SendKeys "^p"
[/code]
SendKeys Method
[url="http://msdn.microsoft.com/en-us/library/8c6yea83%28v=VS.84%29.aspx"]http://msdn.microsoft.com/en-us/library/8c6yea83%28v=VS.84%29.aspx[/url]
Besides I don't recommend to use Sendkeys for BarTender - BarTender is not expected to controlled by Sendkeys.
To automate printing, please use Command line option or Commander in Automation edition.
Command line below would print specific format to specific printer, then close BarTender.
[code]
"C:\Program Files\Seagull\BarTender Suite\bartend.exe" /F="C:\format1.btw" /PRN="Zebra TLP-3844Z" /P /X
[/code]
For continuously printing from another application, Use Commander.
equivalent Commander Script to above would be below - create such text file (trigger) by any application and drop to a folder.
[code]
%BTW% /AF="C:\format1.btw" /PRN="Zebra TLP-3844Z" /P
[/code]
You can embed text database(csv, tab delimted etc) or specify query prompt for format's database connection within trigger.
For detail, please check [url="http://s3.amazonaws.com/SeagullBarTender/ftp/WhitePapers/WhitePaper_CommanderExamples_English.pdf"]Commander Examples[/url] 's Example 3.
Available Commandline options are shown in BarTender's Online help > Automating BarTender > Automation with command line interface > Command line parameter reference.
For Professional Edition (and above), you have "Batch Maker" application (from BT9.2 or later) which allows you to create batch file(*.btbat) to print specific format, with specifying label values, copies and printer etc.
* To edit created batch file(*.btbat) by Batch Maker, Right click the btbat file and edit.
Hope that helps!0 -
Legacy Poster
★ BarTender Hero ★
Can i do it in the label if a text feild is changing it should print 1 label automatically 0
Please sign in to leave a comment.
Comments
2 comments