Can a global variable in DOpus be stored as a vector?

After a thorough search, I can't seem to find the answer to my question: can I make a vector (created through scripting) into a global variable in DOpus?

I would like to create a vector in my script using DOpus.Create.Vector, add some string items to the vector, and then make it available throughout DOpus as a global variable so that I can access the items in the vector from various buttons/scripts and change them as needed. I would need the vector to be persistent.

If it's not possible, I'm wondering if anyone can provide some suggestions on how to make a changing list of strings available to buttons/scripts throughout DOpus (and persistent between sessions). I've considered some possible solutions like keeping a long, delimited string as a global variable and looping through it when needed, or writing and reading from a temporary file, but these approaches seem cludgy. I'm wondering if there's a more elegant solution.

Yes, you can do that:

You can store any type of variable in a Var object, although not all types can be saved to disk. If you want your variable to be persistent you should only use bool , int , string , date , currency or a Vector of those types.


Thanks Leo. I had actually read that description in the manual multiple times but still couldn't get it to work. I should have been more specific in my question: what is the proper syntax to populate and enumerate a vector as a global variable (in VBScript)?

After multiple attempts, I got it to work. The confusing part for me was not knowing that I needed to use the value property to populate and enumerate the vector. In case anyone else stumbles on this post wondering the same thing, here is a working example in VBScript:

Option Explicit
Function OnClick(ByRef clickData)
Dim vecFromScript,item

Set vecFromScript = DOpus.Create.Vector("first item","second item","third item")

DOpus.Vars.set "vecGlobalVariable",vecFromScript

DOpus.Vars("vecGlobalVariable").value.push_back("final item")

For Each item in DOpus.Vars("vecGlobalVariable").value
  MsgBox item

End Function