Hide And Show Barcodes S’abonner

0
Avatar
Legacy Poster

Hi there

 

does anyone have a good vb script that can be used for hiding (not printing) and showing (printing) barcodes.

 

The tricky part is, I want to use two barcodes, different symbologies, linking them to data base fields.

Eg: EAN 13 and EAN 8, I want to place these barcodes above one another. When the print request requires EAN13 I want the EAN13 barcode to print and hide the EAN 8 barcode and vice versa based on the data / requirement(s).

 

Anyone done this before?

11 commentaires

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I'm in a similar situation

 

2 Bar Codes

 

I want to hide/print based on length. 

 

If the data is < 8 characters one size barcode prints, if it is >= 8 print another one.

 

I'm attempting to use something along the lines of this.

 

 

If Len(Field("receipts_data.item") >= 8) Then
    PrintVisibility = True 
Else 
    PrintVisibility = False 
End If
0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi

 

I had the same idea, however I have not tested it yet, however I am not quite sure how Bartender is interpreting the actual barcode. I've done it previously with text fields that are linked to a data base and works perfectly.

0
Avatar
Domingo Rodriguez
Modérateur
Actions pour les commentaires Permalien

If you own one of BarTender's Automation Editions and a recent version of BarTender, you can make use of BarTender's document based VBScripting:

http://www.bartenderbarcodesoftware.com/label-software/whitepapers/Dynamically-Changing-Objects-At-Print-Time-Using-VB-Script.pdf

 

In the below forum topic it is also explained how you can actually hide / show a certain object:

http://forums.seagullscientific.com/index.php?/topic/2050-hiding-objects/

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

I need this same exact VB script. 2 barcodes based on the data coming in - either 11 digit UPC-A or 12 digit EAN-13 number. Has anyone figured it out?

0
Avatar
Fernando Ramos Miracle
Modérateur
Actions pour les commentaires Permalien

Hello junglejims,

 

To get this done, you only need to set two barcode objects one on top of the other, relate them both with the same incoming data (for example the same database field) and change their visibility of each depending on the incoming data (maybe evaluating the data's length).

 

A simple example would be:

 

If Len(Field("<FieldName>").value) > 11 Then

 Format.Objects("<Ean13>").PrintVisibility = True

 Format.Objects("<UPCA>").PrintVisibility = False

Else

  Format.Objects("<Ean13>").PrintVisibility = False

  Format.Objects("<UPCA>").PrintVisibility = True

End If

 

Note that if you are working with BarTender v10.1 there is probably no need of using VB Script, as we've added advanced conditional printing options to objects, layers, templates...

 

Regards.

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi There,

 

I'm using version 9.10

Using Excel file as a dabatase

Field type for (Order$.UPC/EAN) = WCHAR

 

This code is not working and show and error in line 2 and 4 for Type incompatible: 'CStr'

 

If Len(CStr(Field("Order$.UPC/EAN")))=13  Then
    CStr(Field("Order$.UPC/EAN")) =""
If Len(CStr(Field("Order$.UPC/EAN")))=8 Then
    CStr(Field("Order$.UPC/EAN")) =""
End If
End If
 
Any help please, I look for a clean code that do not show the message window.
 
Thanks,
 
Hernando
0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Instead of dealing field value, try edit value.

 

When you want to show / hide EAN13/EAN8 depends on data length,

Create 2 barcode objects 

 

In more options > VB Script,

 

OnProcessData

’For EAN13. not print if value's shorter than 9.

If LEN(Value)<9 Then Value = ""

 

OnProcessData

’For EAN8. not print if value's longer than 9.

If LEN(Value)>9 Then Value = ""

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi,

 

Thanks for your help. I still have a problem. I dont know how to write the code. You said that:

For EAN13. not print if value's shorter than 12.

If LEN(Value)<9 Then Value = ""

 

My code said:

If Len(CStr(Field("Order$.UPC/EAN")))<12  Then
   Field("Order$.UPC/EAN") =""
End If
 
There is an error because field is not recognized, when I tried edit is not recognizes as well.
 
I'm agreed with the 2 barcode objects, but I need to make it work the code for 1 first.
 
Thanks for your help,
 
H
0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

About Post processing, See attached sample.

(Note - this is solution for BarTender 10.0 or before. For 10.1 or later, there's conditional printing as directed above.)

0
Avatar
Legacy Poster
Actions pour les commentaires Permalien

Hi, I am trying to do this same thing on a version 9.10 system... So far, setting the value to "" only makes the Barcode display zeroes (I am using UPC_A for a symbology...

 

Here is a snippet of the VBScript I have tried....

* The "Label Object String" I am trying to show or hide is "UPC_Code"

* The "Named Sub-String" I am basing this off of is "UPC" (It will either have the value "MIXED" or an actual UPC Code)

 

In OnProcessData I have the following (No I wasn't trying all of these at once):

If value = "MIXED" Then

  value = ""             ' The Barcode renders as if the UPC = "0"

  Format.Objects("UPC_CODE").PrintVisibility = false           ' Seems to have no effect at all

  Format.NamedSubStrings("UPC").Value = ""                       ' This also renders a BarCode as if the UPC = "0"

End If

 

Thanx for the help!

0
Avatar
Shotaro Ito
Actions pour les commentaires Permalien

Instead of using VB Script you can simply apply Character filter of Numeric only in Transform (more options) with warning disabled.

When Print preview shows no barcode but print result shows barcode with "0", that means the printer doesn't handle blank barcode well.

In such case, in barcode property(Symbology and size), [Print Method], select [Barcodes and human readable text controlled by BarTender.]

Vous devez vous connecter pour laisser un commentaire.