TestAde.vbs
This example VBScript demonstrates how the CALicense class in ADE can be used to test whether ADE is installed and has a valid license.
Same the code as TestAde.vbs. To run from a command prompt from the same directory, type:
CScript TestAde.vbs
The code
WScript.Echo "Starting test of ADE installation"
Sub Test( adeName )
On Error Resume next
set lic = CreateObject(adeName & ".CALicense")
If Err.Number <> 0 Then
WScript.Echo adeName & " is not installed"
Else
On Error GoTo 0
WScript.Echo adeName & " is installed. Now testing for valid license."
set ade = lic.NewCAEngine
If lic.ErrorCode <> 0 Then
WScript.Echo "*** Error " & lic.ErrorCode & " with " & adeName & ": " & lic.ErrorText
Else
WScript.Echo adeName & " license is valid. Successfully launched."
ade.SendCommand "News"
WScript.Echo "News:", ade.OutputBuffer
End If
End IF
End Sub
WScript.Echo "----------------------------------------"
Test("ADE5")
WScript.Echo "----------------------------------------"
Test("ADE6")
Comments
Enable comment auto-refresher