Access a Vision Window from Perspective?

Hi, is there any way to access a Vision Window or client scripts from a Perspective View on the same project?

Nope, theyā€™re completely independent. However you can run a perspective session inside of Vision using the Web browser component. You still have no methods for them to talk to each other though

Okay, I figured so. I tried the Web Browser, but the Starting URL doesnā€™t seem to load. It just shows a white, blank screen. Any thoughts on why that might be? Thanks for the response by the way!

What url are you using?

I was using a Perspective URL, but that wasnā€™t working so I tried just https://www.google.com/ and unfortunately couldnā€™t get that to work either. I am using this on a RPi 4, so itā€™s possible that could be causing some issues?

you can let them talk with messages, if you provide some vision props(user, client id) through the url with ā€œ:paramsā€, its not very practical/save thoughā€¦

https://docs.inductiveautomation.com/display/DOC81/system.util.sendMessage

@Brit for the url you should use the correct ip and not ā€˜localhostā€™ for testing

Iā€™ll check out the system.util.sendMessage, thanks! As for the correct ip and not ā€˜localhostā€™, what do you mean by that?

configure the starting url like this:
ofc with the right ip, port , project ect
http://172.16.13.4:8020/data/perspective/client/Project/view

to add in the params to easily send messages you will have to use a binding and a script in an expression

'http://172.16.13.4:8020/data/perspective/client/Project/view/'+ runScript('projectScriptLocation.getConfigs()')

this projectScriptLocation.getConfigs should return ā€œclientIdā€ (system.util.getClientId()) and maybe window or page or something (extra params seperated by /)
then you will have to change the url in perspective to pass in these params
https://docs.inductiveautomation.com/display/DOC81/Pages+in+Perspective
https://inductiveuniversity.com/videos/passing-parameters-to-pages/8.0/8.1
So you can use them in system.util.sendMessage() becuase if you dont add in (atleast) a client id it will send to all clients, (which is probably not what you want)

Doing it like this i was able to send a message on a perspective button click to open a popup in vision, idk if this is the best way xd

Would you mind sharing a little bit of how you configured your scripts to open a popup? No worries if not! Most of this is fairly new to me and while the document pages are helpful, Iā€™m still struggling with how to go about this. The binding and script in an expression makes perfect sense and I understand how to get the Client ID, but I get lost on the sendMessage part

Lets back up a step, what exactly is it you are trying to accomplish? Someone does something in perspective (what action?) and thatā€™ is supposed to cause what sort of change in the vision window?

Basically I want a vision popup window to be open at all times on a perspective project. There is a button in Perspective that someone presses. This button writes a ā€œ1ā€ to a boolean tag which is tied to a toggle button in the Vision window. When the toggle button is true, it will run a script that writes a 1 to a GPIO pin on a RPi. When it is false, it will run that same script to write a 0 to the pin. I have a project in Vision that works great with this, but weā€™re wanting to use Perspective for this project and need to be able to write to the GPIO pins on the pi. Which canā€™t be done with just Perspective from what Iā€™ve seen.

If you know anything about Java, you could give this a try:

Hello!
I want to do the same thing, be able to launch the Vision Client Launcher and run an application from there, all that by pressing a button in Perspective. Have you be able to do that or somebody from here?

You cannot. Browsers cannot open arbitrary executables reliably. At most, you could register a protocol handler (individually, on every machine you control) and 'deep-link' from Perspective into Vision.

A Vision Client can run an external browser to open a Perspective, and in most environments, can use the Web Browser module to run Perspective inside Vision. Vision can also directly access files in the local file system, access local devices, access unique local device identifiers, make any kind of network connection to any reachable target system, and run other arbitrary executables.

Perspective can do none of this, and as a browser UI, it should never be expected. (Though there is hope for some of it, in the future, in Perspective Workstation.)

How did you decide to use Perspective over Vision, with requirements like this?

Found this thread while looking to do something else. Can't message handlers do this? I'm able to send messages from a perspective project on an edge device to a vision client running on the gateway, which then does some local processing for me, and it works great. I'm struggling to see a downside with it

Local refers to the clients computer, not the gateway.

2 Likes

Yeah sorry - in this example I just happen to be running the vision client on my gateway, but you can scope a message handler to a project/client, to trigger an execution on the local machine

system.util.sendMessage(project, messageHandler, payload, scope, clientSessionId, user, hasRole, hostName, remoteServers)

Also see now that you suggested this higher up!

Since someone revived this old thread, I'll give my 2c:

Couldn't you just run parallel vision/perspective projects that launch at the same time (or automatically launch the perspective project from the vision project once it's open) and use gateway tags - which both vision and perspective have access to, since you want the vision popup to be open at all times?