06-21-2018 10:17 AM
I use the following snippet of code that works for my needs using VB.NET
oDiadem = New DIAdem.TOCommand
'Save Diadem file as TDM in the specified folder.
nDiademStatus = oDiadem.TextVarSet("T3", sFolderPath & "\" & sFileName & ".TDM")
oDiadem.CmdExecuteSync("DataFileSave(T3, 'TDM')")
'Close down diadem
oDiadem.CmdExecuteSync("DataDelAll(1)")
nDiademStatus = oDiadem.TextVarSet("T3", "ignore") '
oDiadem.CmdExecuteSync("FileModification:= T3")
oDiadem.CmdExecuteSync("ProgramExit()")
oDiadem = Nothing
The file save works fine, but at the "ProgramExit()" call. I get the following error (see attached screen shot)
Clicking OK closes the dialog by the instance of Diadem remains running in memory
06-21-2018 10:38 AM - edited 06-21-2018 10:40 AM
I use:
FileModification = "ignore" ' Just like you do in code pasted below
' nDiademStatus = oDiadem.TextVarSet("T3", "ignore") '
' oDiadem.CmdExecuteSync("FileModification:= T3") ' Instead of Call ProgramExit() i use: Application.Exit()
I do this in DIAdem script so the last line would look different in your code
06-21-2018 10:56 AM
Hi
Thanks for the suggestion but it does not work for application.
Tried the following :
oDiadem.CmdExecuteSync("Exit()")
and
oDiadem.CmdExecuteSync("ApplicationExit()")
Also tried using the CmdExecuteAscync, but still get the same error.
06-26-2018 12:09 PM
if DIAdem wasn't started before it will disappear if ODIAdem is destroyed.
Dim oDIAdem, iSuccess Set oDIAdem = CreateObject("DIAdem.TOCommand") If Not oDIAdem.bInterfaceLocked then iSuccess = oDIAdem.CmdExecuteSync("MsgBoxDisp(""hello"")") End If
If you run this using cscript you will see DIAdem start show Message box and disappear.
I am not sure how it is made sure in .net garbage collection that the object is destroyed.