Vb Script - Include Image Yes Or No Follow

0
Avatar
Legacy Poster

Hello,

I'm trying to integrate VB scripting into a Front-End .

The goal: adding an image in our label when we select "add image" for example and when we don't select it, it shouldnt print.

The script we are trying at the moment goes as following:

If value = "yes" Then
value = "filename.jpg"
Else
value = ""
End If

It does not seem to work.

Any help would be appreciated.

The procedure that we received for it:

Place a picture object on the label, open it's properties and select the "Picture" tab. Set the type to be a "Data Sourced Picture", specify the default path of where the images are stored and choose the, "Never abort print job" radio button. Next select the "Data Source" tab, click the "More Options" button, select the "Prompting" tab and tick the "Prompt at print time" checkbox modifying the other options as needed. Now click the "VBscripting" tab, tick the "Use VB Scripting" checkbox, highlight the "OnProcessData" item from the list and click the "Edit" button. Now use something like the below expression:

If value = "yes" Then
value = "filename.jpg"
Else
value = ""
End If

Note: Setting the value of an image object to nothing has the effect of the object not printing.

3 comments

0
Avatar
Legacy Poster
Comment actions Permalink

We found a solution but it's far from logic, i'll post it later.

the form would be nicer with a box to click in. "include image" checkbox.

This does not work yet.
0
Avatar
Shotaro Ito
Moderator
Comment actions Permalink

It looks your script is good, and if you selected picture property's "Never abort print job", that should've worked.
Attached is BT9.3 Pro format to link checkbox to picture. Unzip files into to the same folder and preview the btw.
Hope that helps!

---
Oops, I missed attachment - here it comes.
[attachment=20:Checked.zip]

* PNG picture files works good with BarTender 8 or later. It kept crisp image quality with compression. However it doesn't handle transparency well, so use PNG file with no transparency.

* You can use relative path in picture datasource. if no default path is specified and just filename is given, it will search file in the same folder as the btw format saved.
using this, you can..
"\images\pic1.png" to get "pic1.png" in "images" folder
"..\pic2.png" to get "pic2.png" in parent folder
Relative path can be used to specify database files too, such as xls, mdb and csv files. Note it won't work when the btw file is in zip archive.
0
Avatar
Legacy Poster
Comment actions Permalink

Thanks for your reply!

I also contacted the customer support by e-mail and the answer i got over there was:

1. For the picture object under the “Picture” tab you are rightly data sourcing the picture via a path. However, instead of just the path you have also included the picture name. This is why it is always printing.

2. The data source tab should contain the name and extension of the picture file to print. If you set this as a prompted item with a check box, then there is no need to resort to VB script. Simply use “Screen Data” source type create a prompt using a checkbox and then specify the value for the checked and unchecked state. This value can be the name and extension of the actual image file itself. When left blank nothing will print for the object.


This worked without a problem.

Please sign in to leave a comment.