Skip to main content
Version: 8.1

system.net.getHostName

This function is used in Python Scripting.

Description​

Returns the host name of the computer that the script was ran on. When run in the Gateway scope, returns the Gateway hostname. When run in the Client scope, returns the Client hostname. On Windows, this is typically the "computer name." For example, might return EAST_WING_WORKSTATION or bobs-laptop.

Client Permission Restrictions​

This scripting function has no Client Permission restrictions.

Syntax​

system.net.getHostName()

Parameters​

Nothing

Returns​

String - The hostname of the local machine.

Scope​

Gateway, Vision Client, Perspective Session

Code Examples​

Code Snippet
# Put this script on a navigation button to link dedicated machines to specific screens.
comp = system.net.getHostName()
# check which line this client is tied to
if comp == "Line1Computer":
system.nav.swapTo("Line Detail", {"line":1})
elif comp == "Line2Computer":
system.nav.swapTo("Line Detail", {"line":2})
else:
system.nav.swapTo("Line Overview")

Keywords​

system net getHostName, net.getHostName