Advice On How To Launch Bartender Using Vbscript Follow

Legacy Poster

I'm new to BT and tried to search for solutions but somehow I am unable to find it.

Basically what I'm trying to do is t read the triggerfile and print number of copies based on the quantity (i.e. apple = 3 pcs, this means I will print 3 labels for apples).

What I did so far is to create a commander task with CommandType = Operating System
[code]D:\test.vbs "%Trigger File Name%"[/code]

And the content of test,vbs is:

[code]Const ForReading = 1, ForWriting = 2
Const colQty = 5
Set oFiles = WScript.Arguments
Set filesys = CreateObject("Scripting.FileSystemObject")

If oFiles.Count > 0 Then
sourceFileName = oFiles(0)
targetFileName = Left(sourceFileName,Len(sourceFileName)-4) & "_b" & Right(sourceFileName,4)
If filesys.FileExists(targetFileName) Then filesys.DeleteFile(targetFileName)

Set sourceFile = filesys.OpenTextFile(sourceFileName, ForReading, False)
Set targetFile = filesys.OpenTextFile(targetFileName, ForWriting, True)

Do Until sourceFile.AtEndOfStream
recLine = sourceFile.ReadLine
rec = Split(recLine,",")
If IsNumeric(rec(colQty)) Then
For i = 1 To rec(colQty)
targetFile.WriteLine recLine
targetFile.WriteLine recLine
End If

'-->> how to activate bartender with this format?? /AF="MyFormat.btw" /P /D=" & targetFileName /DD
End if[/code]

So how can I print the labels?


Ian Cummings
Comment actions Permalink

You shouldn't be using a VB script to run an OS command line. This approach is completely wrong.

The print quantity from a database field is set-up within the label document itself from within BarTender. Do this via the "Print" dialog, clicking on the properties button next to the print quantity in order to allow you to data source it.

Commander also supports Commander Script and XML script which allows you to specify such print time variables, along with print data, in the content of the trigger file itself.

I suggest you start off by reading through the below white papers on Commander:
Legacy Poster
Comment actions Permalink

Thank you for your reply. Its been less than a week since we started using BT. In our previous barcode application, we had to create a script to accomplish this so I am pleasantly surprised BT is integrated with this function without resorting to scripting. Thank you again.

Please sign in to leave a comment.