{}

Our Brands

Welcome to the Schneider Electric Website

Welcome to our website.
How can we help you today?
Example of creating a new object from a mimic script in ClearSCADA
DISCLAIMER

Theis sample program is intended to demonstrate one or more programming functions or methods and is presented as programming example only. Schneider Electric assumes no liability for the use or application of this example program or any portion thereof.


This is a small example to show how a database object can be created from a mimic script in ClearSCADA. The script below creates a instance of a template and names the newly created instance based on the user's input.

Sub CreateInstance

sInstanceName = InputBox("Enter instance name")

If Len(sInstanceName) > 0 Then
    'Specify ClearSCADA Server object.   
    Set oServer = CreateObject ("Serck.ScxV6Server"

    ' Provide connection information to connect to the ClearSCADA Database. The SystemName should be the same as in the Configure Connections utility.
    oServer.Connect "SystemName", "UserName", "UserPassword"
               
    ' Get references to the Group to create the instance in.
    Set oGroup = oServer.FindObject (Server.ThisObject.Parent.FullName)
               
    ' Create the instance by passing the class information.
    Set oNewUser = oGroup.Create("CTemplateInstance")
               
    ' Name the instance.
    oNewUser.Rename(sInstanceName)
    
    Server.SetOPCValue oNewUser.FullName + ".TemplateId", 9 
               
    oServer.Disconnect()

End If
              
End Sub

Schneider Electric Australia

Example of creating a new object from a mimic script in ClearSCADA
DISCLAIMER 

Theis sample program is intended to demonstrate one or more programming functions or methods and is presented as programming example only. Schneider Electric assumes no liability for the use or application of this example program or any portion thereof.
 


This is a small example to show how a database object can be created from a mimic script in ClearSCADA. The script below creates a instance of a template and names the newly created instance based on the user's input.

Sub CreateInstance

sInstanceName = InputBox("Enter instance name")

If Len(sInstanceName) > 0 Then
    'Specify ClearSCADA Server object.   
    Set oServer = CreateObject ("Serck.ScxV6Server"

    ' Provide connection information to connect to the ClearSCADA Database. The SystemName should be the same as in the Configure Connections utility.
    oServer.Connect "SystemName", "UserName", "UserPassword"
               
    ' Get references to the Group to create the instance in.
    Set oGroup = oServer.FindObject (Server.ThisObject.Parent.FullName)
               
    ' Create the instance by passing the class information.
    Set oNewUser = oGroup.Create("CTemplateInstance")
               
    ' Name the instance.
    oNewUser.Rename(sInstanceName)
    
    Server.SetOPCValue oNewUser.FullName + ".TemplateId", 9 
               
    oServer.Disconnect()

End If
              
End Sub

Schneider Electric Australia

Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.
Users group

Discuss this topic with experts

Visit our Community for first-hand insights from experts and peers on this topic and more.
move-arrow-top
Your browser is out of date and has known security issues.

It also may not display all features of this website or other websites.

Please upgrade your browser to access all of the features of this website.

Latest version for Google Chrome, Mozilla Firefox or Microsoft Edgeis recommended for optimal functionality.
Your browser is out of date and has known security issues.

It also may not display all features of this website or other websites.

Please upgrade your browser to access all of the features of this website.

Latest version for Google Chrome, Mozilla Firefox or Microsoft Edgeis recommended for optimal functionality.