Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Scripting_function


Panel
titleDescription

Checks if an OPC server connection is enabled or disabled.

Client permissions restrictions


Panel
titleSyntax

system.opc.isServerEnabled(serverName)

  • Parameters

String serverNameThe name of an OPC server connection.

  • Returns

Boolean - True if the connection is enabled; false if the connection is disabled

  • Scope

Gateway, Vision Client, Perspective Session

Panel
titleCode Examples
Code Block
languagepy
titleCode Snippet
# The following iterates through all configured OPC servers, and check if they are enabled or disabled. 
# This code interacts in the clientClient scope, so it should be placed on a component, such as a Button. 
 
# Retrieve a list of all servers in the Gateway.
allServers = system.opc.getServers()
 
# Initialize a message. The example will append the state of each server to this message.
# The "\n" at the end of the string adds a new line
message = "Server Status:\n"
 
# Iterate through each server.
for server in allServers:
 
	# For each server, append the server name, a colon, the state of the server, and a new line. 
	# isServerEnabled returns a boolean, but may use the string format specifier (%s)
	message += "%s : %s \n" % (server, system.opc.isServerEnabled(server))
 
# Show the state of the servers in a message box.
system.gui.messageBox(message)
Panel
titleKeywords

system opc isServerEnabled, opc.isServerEnabled