Logging Into A Specific Client With A Script

Hey Ignition Community

Looking to try something out. Trying to use my existing barcode readers on the floor to scan employee badges, get username and password, and log into a specific project on a pre designated client.

Getting the user and password from the badge number is easy, what to do after is not so much.

Any ideas are helpful

Set up auto-login as a 'guest' user with permissions to a particular window that has a label (or whatever) telling the end user to scan their badge to log in.

Use scripting to process the badge and then system.security.validateUser to check if the credentials are valid. Then, use system.security.switchUser to change to the provided user credentials.

Alternately, use two projects and use system.util.retarget function to switch to the "real" project.

Hey Paul,

how would I get that directed to a specific client?

To what is the badge scanner attached? I think Paul is assuming it is connected directly to a particular client.

If connected to the gateway, via device connection or otherwise, you will need to use system.util.sendMessage() to broadcast to running Vision Clients and have them, in their client-side message handler, determine if the message applies to that instance. Then it can run system.security.switchUser. (I think Paul's suggestion to use system.util.retarget() is mistaken.)

You will not be able to impact a workstation that is not running a Vision Client at all, nor will you be able to affect a workstation that is running a different project.

I should of posted it earlier, the barcode reader is connected to the PLC, so the badge number is an OPC tag