I want to access a window component in project script. But it is giving me a following error.
“AttributeError: ‘com.inductiveautomation.ignition.common.script.Imm’ object has no attribute ‘gui’”.
I tried to use “import system” in project script, but still getting the same error.
Does anyone have any idea, why system.gui is not getting imported.
And how can i access window component in project scripts without opening window.
That particular error occurs when the script is running in the gateway. The gateway has no GUI, so the system.gui.* functions cannot possibly work, and are therefore omitted. Any script that needs to access a client’s windows and components needs to run as a client event script, not a gateway event script.
Yes but its not supported (and liable to break with Ignition updates), and is a pain to do. If you can rework things to use something else for that, that would probably be easier.
You are close. The value for that component is not .value. There are four different ones, like .intValue or .floatValue. Use the property name that corresponds to the mode you selected for the component.
{ Hover over the property's "pretty" name to get a tooltip with the scripting name. Or look in the manual. }
windows = system.gui.getOpenedWindowNames() #print windows # get list of all open windows
if "Main Windows/MANUAL" in windows: # check if hookupunhookup is open
main = system.gui.getWindow("Main Windows/MANUAL")
button = main.getRootContainer().getComponent("Availability").getComponent("BREAK_TIIME").intValue
This code worked. Thanks@pturmel
There was a extra I in BREAK_TIIME component but that was not the issue, even with proper name I was getting error, but this above code did the job