Populate Field On Format With Event Control Script Follow

0
Avatar
Legacy Poster

Alright. Here's what the situation is, and this is crazy that I can't figure this out.

Basically, I have a script running under Label Format Options under OnIdenticalCopies. This script does various things, such as prompt the user with a MsgBox, do some calculations, and change the size of a rectangle on the format. The point is, I want to take a value calculated in this script, and print it on the format. It seems that the .Value is read only - so what shall I do? Is there a way to share a variable across all fields that I can call from the particular field I need to use it?

4 comments

0
Avatar
Domingo Rodriguez
Moderator
Comment actions Permalink

You can achieve this e.g. with the following VBScript code:

If Objects ("Barcode 1"). value = 12345678 Then
Format.NamedSubStrings("mytext").Value = "Yes"
End If

"mytext" is a shared sub-string which you've created previously by opening the properties of the text / bar code object in BarTender and now selecting the "Data Source" tab. Press the "More Options..." button and you will now see a "Share / Name" sub-tab. It is here where you can place the name of your substring to be e.g. "mytext"
0
Avatar
Legacy Poster
Comment actions Permalink

This code seems to work in the OnPrintJobStart method - but not on the OnNewRecord, OnSerialize, or OnIdenticalCopies (and probably others, but those are the ones I've tried). Those three simply return an error "Cannot write to read only property".

Thanks.
0
Avatar
Legacy Poster
Comment actions Permalink

[quote name='nRyder' timestamp='1325183398' post='1415']
This code seems to work in the OnPrintJobStart method - but not on the OnNewRecord, OnSerialize, or OnIdenticalCopies (and probably others, but those are the ones I've tried). Those three simply return an error "Cannot write to read only property".

Thanks.
[/quote]

Still no answer on why this is the case? Can anyone replicate the experience I'm having? (Sub-string value can be set OnPrintJobStart, but not other methods)
0
Avatar
Gene Henson
Moderator
Comment actions Permalink

Hello nRyder,

Actually, this is by design. Document level VB Scripts are not allowed to modify object substrings during those three events. The best workaround is to use a data sourced VB Script to change the substring value as needed.

Will that work for you?

Sorry for any inconvenience that causes and for the wait time in getting you a response.

Please sign in to leave a comment.