Initialize Values on vision window

What is the best way to initialize values on a vision window when it opens? I have used the visionWindowsOpened script, but it doesn’t always work the way I think it should.

Where really necessary, I tend to use an expression binding that is just a constant. Only executes once when the component is started up.

1 Like

Hello Sir.

Can you explain that?
I'm looking to tell the user "yes you have permission" and open home,
or "sorry, you don't have permission, you must be an administrator"

I supposed use [System]Client/User/RolesString

many thanks

Have you taken the courses at inductive university? Highly recommend them.https://www.inductiveuniversity.com/ to show you the basics of bindings.

You wouldn't want to use that tag directly. In a binding you could want to use hasRole('administrator') which would be true if the user had that role, false otherwise. Or in scripting you could do if 'administrator' in system.user.getRoles():

I don't know how much sense either of these will make though if you are not familiar with the general setup of Ignition. I highly recommend taking the courses in my first link.

1 Like

Hello sir, yes I have been reading the courses while developing but I have not found something similar
After pressing login, I look to open only if the user is admin... on Vision

image

Next time I would recommend making a new topic as this does not really relate to the original thread. But since you are here, under project properites you should see
image

Put administrator in there.

1 Like

Many thanks!

I hadn't really seen this before, not even in the tutorials

grateful!