Hello All,
as the title states the properties of an global object of an self-created class disappear when I rerun a script or run another script manually.
This issue does NOT appear when I call the second script with scriptstart()
Here is a short example to show you what I mean.
Script1:
Option Explicit
class cProperty
public Name
end class
Globaldim "sString"
sString = "DEF"
Globaldim "oObject"
set oObject = new cProperty
oObject.Name = "ABC"
call msgbox(oObject.Name) 'Outputs "ABC"
Script2:
'class cProperty 'Declaring the class in Script2 won't make any difference
'public Name
'end class
call msgbox(sString) 'Always Outputs "DEF"
call msgbox(isObject(oObject)) 'Always Outputs "true"
call msgbox(oObject.Name) 'Outputs error "Object doesn't support this property or method" when run manually after Script1
'Outputs "ABC" when run with scriptstart("Script2")
It seems like when you want to access the properties of the object, the reference of the object to the class is lost after the scriptengine has stopped running
I was just wondering that this happened and wanted to know if there is an easy workaround for that like declaring a class globally?
I recognized this behaviour because I want to accomplish the following task.
I have a dictionary with Objects as Items. The Objects are of an own class with properties which store information
On the first run of the script the user inputs different information which I store in the properties of the objects in the dictionary.
When the script is run again (provided the DIAdem has not been restarted) I want to display the information again.
Thank you for your help!
benebelt1