I want to add an event handler for Expedition so that when it closes it will set the default license to be used on next instantiation to Ascent. I found the example for event handling in the documentation, copied it and made the changes for what I needed accomplished. My problem is arising from code already populated in the example.
"Set docPCB = GetLicensedDoc(appPCB)" is where the script dies when I am opening Expedition.
And the error is:
Type mismatch: 'GetLicensedDoc'
Any help on fixing the error would be appreciated. Thanks.
' The example below shows the event handler framework for an
' Expedition application object.
doNotExit = True
' The application is quitting
'Sets the default license back to Ascent
Dim Reg, Path
set reg = CreateObject("WScript.Shell")
Path = "HKCU\Software\Mentor Graphics\ExpeditionPCB\Expedition PCB\2007.00\Licenses\"
reg.RegWrite Path & "Pinnacle","0", "REG_DWORD"
reg.RegWrite Path & "Ascent LX","0", "REG_DWORD"
reg.RegWrite Path & "Ascent","1", "REG_DWORD"
'MsgBox "Quitting the Application"
'Exit the infinite loop
doNotExit = False
' Make sure all objects are released "
Set docPCB = Nothing
Set appPCB = Nothing
' Testing code for the sample
Set appPCB = GetObject(,"MGCPCB.ExpeditionPCBApplication")
Call Scripting.AttachEvents(appPCB, "appEvents")
' collect document object
Set docPCB = GetLicensedDoc(appPCB)
' An infinite loop to prevent script from exiting
Do While doNotExit