"global" Procedures For All Events Conflicts With Text Obj Data Source Script?? Follow

0
Avatar
Legacy Poster

I want a global counter in  Procedures For All Events, so I do this:

 

 

counter = 1
 

 

Then I create a single-line text object, and set its data source to VBS as a single-line expression. I leave the default "Sample Text".

 

I get this error in the Text Properties dialog:

 

Output:

Procedures for All Events (Line 1):  Variable is undefined: 'counter'

 

What gives? Why should the text object possibly care about a properly-defined global var?

 

This seems like it should be really simple, but the notion of a global space via seems to be all sorts of a problem. (this post is relevant to the global space in a different way, especially this comment)

 

(I'm using BarTender2016)

2 comments

0
Avatar
Ian Cummings
Moderator
Comment actions Permalink

It looks like you have to define the variable first:

 

Dim counter
counter = 1

With this done the error in the single line VB script goes away.

0
Avatar
Legacy Poster
Comment actions Permalink

Thanks Ian; initially I tried declaring and assigning on the same line, which I guess isn't allowed. I got some help via this response in a different thread and thankfully have gotten past similar noob mistakes since then :)

Please sign in to leave a comment.