Is there a cleaner way to get the OS from scripting other than the following?
response =system.net.httpGet("http://localhost:8088/system/gwinfo")
response_values = response.split(';')
for value in response_values:
if value.split('=')[0] == 'OS':
print(value.split('=')[-1])
This works… but it feels dirty
from java.lang import System
print System.getProperty("os.name")
1 Like
You could sendRequest
to the gateway, then run this:
from com.inductiveautomation.ignition.common.util import Platform
Platform.getOS().name()
All it does is parse the os.name
system property from Kevin’s snippet, but it might be friendlier to use.
EDIT:
Oh, and you can use system.util.getProperty
(which is just an alias for System.getProperty) if you want. We even documented os.name
:
https://docs.inductiveautomation.com/display/DOC81/system.util.getProperty
4 Likes