07-21-2008 11:19 AM
07-21-2008 06:13 PM
I've made a bit of progress.
In the script I am running I wanted to see if the user command file was actually registered. Ofcourse, the user command file shows up when I look in the Settings->Options->Extensions->User Commands. It is there and has a status of Loaded. So I'm confident the user command file is loaded. Maybe?
Anyway I use the following code to check within the script where I am using the command (which is actually a class)
Msgbox(ScriptCmdIsLoaded(ScriptLibrPath&"DP4Yaw_clslib.vbs")
While running the script, the message box pops up and displays the text "TRUE." Unfortunately, when the script tries to execute the next line of code it halts and errors out and gives the error message that the class is not defined.
So, I then add another line of code just below the line to check if the user command file is loaded. I added
Call scriptInclude(ScriptLibrPath&"DP4Yaw_clslib.vbs")
This makes all the difference. It actually works now. The class is instantiated, the script runs!
Why do I have to explicity run the scriptinclude command if the file is already loaded as a user command? I don't have to do this with any of my user command files that contain subprocedures and functions, only the ones containing classes. Also, this problem hasn't occurred with the earlier versions of DIAdem. It seems as if the user command file is not truly being registered such that I can instantiate one of the class objects coded in the user command file.
Thanks-Ryan37
07-22-2008 01:22 AM
Option Explicit
Class CMyClass
Public Sub Test()
MsgBox CStr(now)
End Sub
End Class
Public Function MyClassNew()
Set MyClassNew = new CMyClass
End Function
Option Explicit
Dim o
Set o = MyClassNew()
Call o.Test()
| Matthias Alleweldt Project Engineer / Projektingenieur | Twigeater? |
07-22-2008 05:33 PM