Enable Serialization Conditionally? Follow

0
Avatar
Legacy Poster

I have many data sources that are multi-line VBscripts. I want to add in a script (in the multi-line script itself, or maybe in the OnProcessData event?) that will enable serialization for that data source depending on the text of the data source. Is this possible? Or will I have to write a confusing roundabout way of serializing the data within the VBscript itself? 

4 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

You set the value of a data source with the expression: value = x

 

With this in mind, create a variable with a numeric value, increment it at various intervals within a conditional statement.  Perhaps make use of an event based VB script rather than just an ordinary multi-line VB script.

0
Avatar
Legacy Poster
Comment actions Permalink

How would I set up the script so that the program knows to print more than just the first serial number of the template for which I have this scripted serialization set up? I understand how to set up a counter variable to change the text value, but if I only have one template using this counter to serialize and have other templates without serialization, how will the program know to print multiple times until my counter limit is reached?

 

Also, can you explain why there is no real support for global variables in BarTender scripting? I was trying to load an object I declare in the "shared for all events" script with information during the OnOpen event, then use that object to load values into data sources, but you simply can't do it. You get object required errors in every data source's script trying to access the object. The way your script editor phrases things makes it seem like this should be possible, but instead I have to declare a new object and call the function to load the object with data in every single data source script. This is computationally costly and extremely frustrating.

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

The built-in serialization feature for a data source cannot be programmatically enabled/disabled via VB script.

 

If you have multiple templates in a document, for example A, B, and C, it is not possible for VB script to set the print quantity to A as 1, B as 5, and C as 2.  All you can do is set whether the template will print or not for that particular iteration. If what you want to do is batch printing, then you're better served controlling the print process externally via the .NET SDK or the Integrations Platform.

 

Global (effective public scope for the document as a whole) VBS variables are supported via the "Procedures for all events" script.  Perhaps you could send me a simplified example of what you're doing for me to examine...?

0
Avatar
Legacy Poster
Comment actions Permalink

See my other post here for a simplified version of the file I am working with.

Please sign in to leave a comment.