Accessing window component in Project/Gateway scripts, without opening a window

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.

Appreciated your help

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.

Can a component still be accessible event though a window is not running if try to access from client 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.

What are you trying to do exactly?



I am trying to access property of a component in Client tag change event scripts.i am getting error - what is wrong here ?

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. }


Still have the error, time to look into manuals

Look for a mistake in your names. Like extra spaces.

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