Open Automation Software
Moving Data From Anywhere to Anywhere
1-303-679-0898

Client Script Library Reference

Web HMI provides some useful client script utilities for developers who wish to have more control over application behavior. The following objects and functions are available to use:

OPC.authenticate(string, string)

Pass in a username and password to perform a server authentication call. Once complete, all tag data requested from the server will occur within that user’s context and bound to that user’s permissions. If the user does not have access to a given tag, no value will be returned. The authentication is performed asynchronously, and will take effect when either the call completes successfully or fails. Upon completion or failure, the OPC.token value will be updated. Upon failure, the OPC.token will be set to “AUTH FAILURE” when there is a communications issue, but will be set to a GUID token for all other results. Note: the user identity and permissions are managed within the Open Automation Software Server:

OPC.get_value(string)

Pass in a tag as a string to get the current value for that tag:

OPC.set_value(string, string)

Pass in a tag as a string, and a new value and that value will be set on the server:

OPC.toggle_refresh(bool)

Temporarily disable or re-enable server polling for new tag values. If no parameters are passed in, polling will toggle, turning off when currently active, or back on when suspended. To explicitly start or stop polling, pass in a boolean true or false, respectively:

OPC.init()

Reinitialize the client script library and begin polling. Use this function if there is ever a need to update any configuration settings, for example if you ever choose to programmatically point to a different serverURL, add tags to the watch_tags array, or add elements to the screen to be parsed and managed by Web HMI behaviors: