Difference between revisions of "TestAde.vbs"
(Created page with "Category: ADE User Guide This example VBScript demonstrates how the CALicense class in ADE can be used to test whether ADE is installed and has a valid license....") |
|||
Line 7: | Line 7: | ||
== The code == | == The code == | ||
− | WScript.Echo "Starting test of ADE installation" | + | |
+ | WScript.Echo "Starting test of ADE installation" | ||
| | ||
Sub Test( adeName ) | Sub Test( adeName ) | ||
On Error Resume next | On Error Resume next | ||
− | set lic = CreateObject(adeName & ".CALicense") | + | set lic = CreateObject(adeName & ".[[CALicense]]") |
If Err.Number <> 0 Then | If Err.Number <> 0 Then | ||
WScript.Echo adeName & " is not installed" | WScript.Echo adeName & " is not installed" | ||
Line 17: | Line 18: | ||
On Error GoTo 0 | On Error GoTo 0 | ||
WScript.Echo adeName & " is installed. Now testing for valid license." | WScript.Echo adeName & " is installed. Now testing for valid license." | ||
− | set ade = lic.NewCAEngine | + | set ade = lic.[[CALicense::NewCAEngine|NewCAEngine]] |
If lic.ErrorCode <> 0 Then | If lic.ErrorCode <> 0 Then | ||
WScript.Echo "*** Error " & lic.ErrorCode & " with " & adeName & ": " & lic.ErrorText | WScript.Echo "*** Error " & lic.ErrorCode & " with " & adeName & ": " & lic.ErrorText | ||
Else | Else | ||
WScript.Echo adeName & " license is valid. Successfully launched." | WScript.Echo adeName & " license is valid. Successfully launched." | ||
− | ade.SendCommand "News" | + | ade.[[CAEngine::SendCommand|SendCommand]] "News" |
− | WScript.Echo "News:", ade.OutputBuffer | + | WScript.Echo "News:", ade.[[CAEngine::OutputBuffer|OutputBuffer]] |
End If | End If | ||
End IF | End IF |
Latest revision as of 22:18, 10 March 2021
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