Use Specific Printer Based On Textbox Entry
Hello-
I am trying to help our warehouse with labeling. They have some material that is owned by the customer, and other material owned by us. We had done a bad job keeping this material separate, and want to improve.
As a suggestion, I said we should buy a second printer with different colored labels. Then we would just print to the appropriate label as needed. I bought the printer and labels, and everything is working as I suggested.
However, the request has been updated is to use info in a database-sourced textbox to pick the printer for us so the warehouse crew won't have to remember which label to use (I guess paying attention was the original issue anyway, and a new printer wasn't going to fix that).
So.....I'd like some script to key off the last letter in that textbox. If it's a "C", then print to printer A, otherwise, print to printer B. I'd also like to make a textbox visible that says the material is customer owned when the last letter is "C".
Is this possible?
Thanks!
Brian
-
That is possible, however I'm not aware if it is possible to switch printer within Bartender except for setting the default printer with VBScript. So you could try this:
Create two Named Data Sources. One which contains the database data and one that will contain the line "the material is customer owned" when printer C is selected.
On the OnPrintJobStart event use the following code:
Dim valueToCheck Dim objPrinter ' Set the printer object' Set objPrinter = CreateObject("WScript.Network") ' Retrieve the last letter from the text' valueToCheck = Right(Format.NamedSubStrings("name of database named source").Value, 1) ' Check which printer to use' If UCase(valueToCheck) = "C" Then objPrinter.SetDefaultPrinter "Name of the printer to use when C is found" Format.NamedSubStrings("Name of the Data Source which should be visible when C is found").Value = ("the material is customer owned") Else objPrinter.SetDefaultPrinter "Name of the printer to use when C is NOT found" Format.NamedSubStrings("Name of the Data Source which should NOT be visible when C is NOT found").Value = ("") End If
When a print command is given the script checks the value for "C" and swaps the default printer and fills the textbox if needed.
0 -
That looks like a reasonable approach. I have to work on the supporting database a little more before I try it, so I'll let you know.
Also, I know this is a noobie question, but I do have a lot of experience with VBA and have found a lot of internet support on there, explaining programming with VBA. However, with VB Script, there doesn't seem as much, and I'm getting the idea that Bartender actually only allows a portion of what VB Script can do.
With that said, is there a resource out there that gives the fundamentals of VB Script programming for Bartender? The help topic section in Bartender doesn't seem very helpful, and I hate to use this site to ask basic questions.
Sorry, that was a little off topic, but I do wonder....
0 -
BarTender 2016 beefed up its VB Script engine, alongside with the documentation. I'd suggest anyone working with VB Script to download the trial and strongly consider upgrading.
0
Please sign in to leave a comment.
Comments
3 comments