I have a script that test a local ip for connected PLC unit info. I want to call this from a button i ignition.
I am not sure where to put the script. On the button or in gateway scripts ?
Also how to get the result show up in a textbox
Here is my script:
import subprocess
pythonPath = "C:/Program Files/Python313/python.exe"
scriptPath = "c:/Python/S7_Dev_Env/listOnlineDevice.py"
param1 = "5"
result = subprocess.check_output([pythonPath, scriptPath, param1])
print result
Where does the .py file live - on the client running vision, or on the gateway? If the client is running perspective, all scripts run on the gateway and it will need to be on the gateway.
You will want to use ProcessBuilder over subprocess. Check out this example though there are others here if you search
Note too - if this is vision - it does likely make more sense to have it on the gateway instead of putting a .py file on every single client. You can then write the result to a gateway tag and bind the button text to that in some fashion, or use message handlers.