Skip to main content

Search

Search

Use Specific Printer Based On Textbox Entry

Comments

3 comments

  • Avatar
    Legacy Poster

    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
  • Avatar
    Legacy Poster

    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
  • Avatar
    Jenna Ingersoll
    Moderator

    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.