Password Protect Button Action

How do I put a password on a button. I want to require a user to input a password prior to the button preforming designed action.
Thanks

It’s generally a better idea to use FactoryPMI users and groups to password protect a button. This can be done with the security option on the component itself. Users that aren’t allowed access will simply see a disabled or totally hidden object (button).

Here’s how you would do it with a fixed password. You could easily modify this script to retrieve the password from the database.

On the actionPerformed event of the button enter the following code:

txt = fpmi.gui.inputBox("Enter password:", "")

if txt == 'MyPassword':
	fpmi.gui.openWindow('LoadScreen')
else:
	fpmi.gui.warningBox("Incorrect Password")

Feel free to replace the fpmi.gui.openWindow(‘LoadScreen’) with whatever action you want a button push to perform.

Thanks Nathan and Carl for your assistance. I’ll keep you posted with results