Calling getWindow from a project script

I’ve simplified my problem down to a test: my button calls a function in the Script Library

def setEnableStatus():
	import system
	print "Button pressed."
	try:
		window = system.gui.getWindow('Overview')
	except:
		print "Failed to get window."	

The console reports

Button pressed.
Failed to get window.

The Overview window exists in the default project location. The window is open (and the button is on it).

What am I missing? Do I need to import anything else?

Try system.gui.getOpenedWindows() - are you sure there isn’t a trailing space or folder or something else?

Does “Overview” exist in a folder? getWindow is expecting a path to the window. If you have a window called Overview, you can right click it and choose copy path and paste that into the script.

2 Likes

Thank you both. SY is correct. I was missing the path to the window. The correct syntax is

"Main Windows/Overview"

I had read extensively through the documentation and didn't find an example of this. All refer to "Overview".
The Copy Path will be a useful trick.