[Question] Is there a way to access Perspective Views in the Script Console?

Using the system.gui.getWindow(‘Window Name’) call, one can access vision Windows and their subsequent components. Is there a similar way to access Perspective Views in the Script Console?

(edit: Clarified question.)

There is no function to access Views in such a manner.

Views and their properties should be addressed via property-accessing:

self.view.custom.some_property

An Embedded View (named ‘EmbeddedView’) would be accessed in the following manner:

self.view.getChild('EmbeddedView').custom.some_other_property

There’s no ‘self’ in the script console… :neutral_face:

Whoops - I read the whole Thread title except for the last word… :grimacing:

There is absolutely no way to access anything perspective in the script console because - as you just said - there is no self in the Script Console. Everything in Perspective needs some idea of context (am I checking my properties? Am I checking the properties of my sibling/view?)

That being said, the system.perspective function calls will not work in the Script Console either because they all require a sessionId or pageId behind-the scenes. This is either provided by the user to target a specific page, or it defaults to the sessionId/pageId currently in use. You really don’t want to try something like system.perspective.navigate(view='my_view') in the script console - in fact, the script console even notifies you that there is no system attribute ‘perspective’ available in the Script Console when you try.

1 Like

You really don’t want to try something like system.perspective.navigate(view='my_view') in the script console…

I already have :grin:

Thanks for the explaination.

1 Like

I have a related problem. I am using Perspective and trying to refreshBinding on a component’s property. This component is on the view that is the main window, but I want to be able to do it by clicking a button on a popup.

How can I reference components on the parent view from its popup?

You cant, you will have to send a message on the component and a messagehandler with the same name on the main window
https://docs.inductiveautomation.com/display/DOC81/system.perspective.sendMessage

1 Like