06-27-2018 05:07 AM
Hi all,
I would like to define a global user constant in a VBS script in DIAdem 2017, which is going to be used by other scripts. This constant will have information that depends on the computer I'm running the scripts. My idea is to only run once the script that defines the global user constant, and have the users run the other scripts without needing to worry about it.
I saw that there are "user variables" in DIAdem 2017 (link), but the recommended way of defining them (UserVarCompile) seems to be obsolete (link). Would anybody have an idea of how to implement this?
Thanks
Franco
Solved! Go to Solution.
06-27-2018 07:37 AM
Hi Franco
There are several solutions for your problem. The easiest is that you use the global variables that are already defined in DIAdem: R1 to R32 for real variables, T1 to T10 for text variables, or O1 to O10 for variant variables.
A bit more complex is to define your global variables. In this help topic you find a description how to do this.
Defining User Commands and Global Variables
Hope this helps
Winfried
06-27-2018 08:03 AM
Hi Winfried,
Thank you for your reply. I'm looking for something more "read only", i.e. once the variable has been defined it cannot be easily changed by another script. The "user variables" I mentioned earlier seems to have that option, is it possible to do that with a global variable defined through the user commands?
06-27-2018 08:34 AM
Hi Franco
Simply use the "const" in the user command script, eg:
const myTest = "this is myvalue"
This variable is readonly.
06-28-2018 03:36 AM
Hi Winfried,
I think this will work, thanks!