Scripting > CxHmiRsm > CxHmiRsm Example

CxHmiRsm Example

The following is an example of using the CxHmiRsm in CygNet Studio.

CxHmiRsm Example
CxHmiRsm Example

Script File

'(Declarations)

 

' Global objects

Dim g_objGlobFunc

 

'End of (Declarations)

 

Sub btnConfigure_EventClick()

Dim This : Set This = btnConfigure

If CxHmiRsm.SiteService <> "" Then

CxHmiRsm.Configure

Else

MsgBox "No RSM service selected."

End If

End Sub

 

Sub btnDelete_EventClick()

Dim This : Set This = btnDelete

If CxHmiRsm.DeleteEnabled() Then

CxHmiRsm.Delete

Else

Dim strMsg

strMsg = "'Delete' is not enabled for one or more of the selected services."

strMsg = strMsg + " No selected services can be running, starting,"

strMsg = strMsg + " stopping, or failed."

MsgBox strMsg

End If

End Sub

 

Sub btnKill_EventClick()

Dim This : Set This = btnKill

If CxHmiRsm.KillEnabled() Then

CxHmiRsm.Kill

Else

strMsg = "'Kill' is not enabled for one or more of the selected services."

strMsg = strMsg + " All selected services must be either running,"

strMsg = strMsg + " starting, stopping, or failed."

MsgBox strMsg

End If

End Sub

 

Sub btnNew_EventClick()

Dim This : Set This = btnNew

If CxHmiRsm.SiteService <> "" Then

CxHmiRsm.New

Else

MsgBox "No RSM service selected."

End If

End Sub

 

Sub btnProperties_EventClick()

Dim This : Set This = btnProperties

If CxHmiRsm.PropertiesEnabled() Then

CxHmiRsm.Properties

Else

strMsg = "'Properties' is only enabled when exactly one service is selected."

MsgBox strMsg

End If

End Sub

 

Sub btnRefresh_EventClick()

Dim This : Set This = btnRefresh

If CxHmiRsm.SiteService <> "" Then

CxHmiRsm.Refresh

Else

MsgBox "No RSM service selected."

End If

End Sub

 

Sub btnRestart_EventClick()

Dim This : Set This = btnRestart

If CxHmiRsm.RestartEnabled() Then

CxHmiRsm.Restart

Else

strMsg = "'Restart' is not enabled for one or more of the selected services."

strMsg = strMsg + " All selected services must be either running, defined,"

strMsg = strMsg + " stopped, misconfigured, or stopped during startup."

MsgBox strMsg

End If

End Sub

 

Sub btnStart_EventClick()

Dim This : Set This = btnStart

If CxHmiRsm.StartEnabled() Then

CxHmiRsm.Start

Else

strMsg = "'Start' is not enabled for one or more of the selected services."

strMsg = strMsg + " All selected services must be either defined,"

strMsg = strMsg + " stopped, misconfigured, or stopped during startup."

MsgBox strMsg

End If

End Sub

 

Sub btnStop_EventClick()

Dim This : Set This = btnStop

If CxHmiRsm.StopEnabled() Then

CxHmiRsm.Stop

Else

strMsg = "'Stop' is not enabled for one or more of the selected services."

strMsg = strMsg + " All selected services must be either running"

strMsg = strMsg + " or stopped during startup."

MsgBox strMsg

End If

End Sub

 

Sub cboServices_EventChange()

Dim This : Set This = cboServices

CxHmiRsm.SiteService = cboServices.GetText(cboServices.Selection)

End Sub

 

Sub TheView_EventInitialize()

Dim This : Set This = TheView

 

Set g_objGlobFunc = CreateObject("CxScript.GlobalFunctions")

 

Dim arrServiceDefs

 

On Error Resume Next

g_objGlobFunc.GetServiceDefs "", "RSM", "OK", "", "", arrServiceDefs

 

If Err.Number <> 0 Then

g_objUQAUtilities.DisplayMessage("Cannot obtain any running RSM services.")

Err.Clear

Else

If UBound(arrServiceDefs) = -1 Then

g_objUQAUtilities.DisplayMessage("Cannot obtain any running RSM services.")

Else

Dim i

For i = 0 To UBound(arrServiceDefs)

cboServices.AddString arrServiceDefs(i, 0)

Next

 

' select the first item in the list

cboServices.Selection = 0

CxHmiRsm.SiteService = cboServices.GetText(cboServices.Selection)

 

End If

End If

 

On Error Goto 0

 

End Sub

Back to top

Let us know how we can improve this topic.

CygNet at weatherford.com

© 2020 Weatherford. All rights reserved.