Help on log out navigation

I don’t know how to do much script. There is a log out icon that logs out user logging in. I would love to some how navigate out of screen while clicking on log out. How is this done. It logs out user, but I don’t know how to do other option.

Right-click on the icon in Designer and choose Scripting. You’ll likely find the script there that does the logout. Choose an appropriate system.nav function and add it to the script you find there. If you can’t get the desired results, post your script with three triple back quotes on one line above and one line below it and let us know what is happening and what you’d like to happen.

Ok. I really appreciate your reply and will post script tomorrow while at work. I am little old school and was always on factory talk me/se and was faster in doing stuff like this. But I now understand how powerful python language is.

You bet; there’s a learning curve with anything new, but Ignition has been one of the most rewarding ones for me. Welcome to the forum!

Got it thanks. I am was not sure what was wrong with me. But I forgot the tab was there to do the navigation, Iol. I was beat at the e d of the day. I just added auto log out script and it worked, but it completely logs the client out. I would like to auto logout and navigate to main menu, should I just paste in what the navigation button do ?

I tried it and it still completely logged off. Here is the script.

Preformatted text<img src="//" width="243" height="500">

Yes, you can add to/edit the scripts it creates. However, if you log out and don’t have auto login enabled you’ll just get the login screen, not the Main Window page you’re looking for.

In Designer, go to Project->Properties->Client Login to setup auto login for a user with access to only what you want accessed before login (at least the Main Window). You’ll need to check Enable Auto-Login and fill in that username and password you want it to switch to on logout to allow access to Main Window.

Then your script will likely work. You may need to put the window change lines before the logout line in the script.

Be aware that auto-login does significantly reduce the overall security of your site, and is not recommended by IA for current projects. Yeah, there are reasons we users want to keep it, but it is a security hole.

1 Like

I tried this script and it works, but now it keeps running it. I did not use logout in the script because even if i set the auto log in with user name and password it still logged me out. If I use log out in script in stead of using switch user, it only runs once.

Try indenting your last two lines so they are part of the “if” statement.


It stills does the same. Any other options ?

Your script in screen clipping above will run any time there is no activity (mouse movement, etc.) for ten seconds when the script runs. If you want it to wait for a longer period of inactivity, change the “10” in it to the number of seconds of inactivity you want to require to execute the lines indented below the if.

It still does the same thing. My issue is, if they are logged in and are in a security screen and logged out, they remain in that screen.

Based on your use of system.util.getInactivitySeconds() I assumed this script was running somewhere other than on a logout button. If this is on your logout button, your script while never run because the inactivity seconds will always be zero when it runs (due to the fact the button was just pressed, which counts as activity). If this is on a button, you probably want your script to run any time the button is pressed. Remove the if condition like this:

window = system.nav.openWindow('Main Window')
system.nav.centerWindow(window)'view', 'view')

it was set in the auto log out, under client script.
Here is what I am trying to do. I am little old school and used to Factory talk ME/SE and this makes it easier.
I have visual buttons that navigate to screens when I sign on to do maintenance. When those buttons appear, I can go to the other screens. What I need is a auto log out to this generic profile,‘view’, ‘view’) and window changed back to main window, window = system.nav.openWindow(‘Main Window’) so they are not left in a security screen. I am pretty sure this can be done, but this SCADA system relies alot on script which is the part I need help on.

I would put this in Client Timer Scripts with a delay of maybe 5000 ms (however often you want it to check inactivity):

# Switch to Main Window and view user when inactive.
if system.util.getInactivitySeconds() > 10:
	system.nav.swapTo('Main Window')'view', 'view')

I’m taking a guess here that swapTo is likely what you want; you can change that back to openWindow if not.

what about this ?

Those timer script settings look good; it should run 1000 ms after the last time it finished.

Is something still not working? If so, please copy your script, press Ctrl-Shift-C in the post box here on the forum and then Ctrl-Shift-V to paste your code in the preformatted text block to make it easy to read

it worked, but I should have stated I don’t want it to work all the time. so what happens is when I am on the main window the screen glitches of and on, because script always runs. Also operators still want to look at the screen they are operating but will lose control options which is ok, they can log back on. So is their any way to some how add some thing in the script that only excutes when certain people log in. For example something thing like this

IF user view looged on
THEN dont run script
IF user 1,2,3,4 logged in
THEN swich window to main window
log user out.

Switch to Main Window and view user when inactive.

if system.util.getInactivitySeconds() > 100:
system.nav.swapTo(‘Main Window’)‘view’, ‘view’)

I have a similar application where a supervisor needs to log in to adjust setups. This will switch screens if it is in the setup screen, otherwise, it just switches the user.

# Check for inactivity for a non-user account
if system.util.getInactivitySeconds() > 300 and != "defaultUser":
	# Check if setup screen is showing
	if system.nav.getCurrentWindow() == "Main Windows/Setup":
		# Swap to main screen
 		system.nav.swapTo("Main Windows/Main")
		# switch to default user"defaultUser","superSecretPassword")
		# Otherwise, just switch to the default user"defaultUser","superSecretPassword")

Looking at it now, it could be shortened up a bit, but this should provide enough clarity to show what it’s doing.

1 Like