Different main page for each user


I have a question about the login page for each login/user. Is it possible to have a different main page (first page after login) for each user?

Mitchel Gommers

Hi Mitchel,

You sure can! Look under Project :arrow_right: Client Events. Use a Client Startup Script.

Here’s one that I use. It helps monitor the amount of free hard drive space on a Windows client. It also rejects the maint_hch user, since my maintenance guys should be logging in under their own credentials.

EDIT: Sorry, should mention that in here you would use the system.nav.openWindow() or similar to do what you’re asking. :slight_smile:

Thank you!

The script that I wrote don’t work. When I log on as Operator 51 I don’t get the right page.

name = system.tag.getTagValue("[System]Client/User/Username")
if name == ‘Operator51’
System.nav.openWindow (‘IS machine 51’)

Did you type your script with the correct INDENT ?
For example here is a script i would use to read a tag and print something if the tag’s value equals another value.

if test==1:
	print test

You could try running your script from the Script Console in the designer so that you can see if there are any errors in it.
Try to write the value ‘Operator51’ in the [System]Client/User/Username tag. Then type this code in the Script Console :

if name=='Operator51':
	print 'Open IS machine 51'

Don’t capitalize the “system” in system.nav.openWindow(). And the line with the ‘if’ needs a trailing colon. Look in your diagnostic console on the client to see the syntax error. Finally, when pasting code in this forum, place three back-quotes (these: ```) on a line above the code and again below the code to trigger proper formatting. Then we can see if you’ve used proper indentation.

1 Like

I have tried and it worked, it printed the text in the script console. But when I want to open the window I get an error

I use this code:

if name=='Operator51':
nav.openWindow ("IS machine51")

and I get this error:

SyntaxError: ("mismatched input 'nav' expecting INDENT", ('<input>', 3, 0, 'nav.openWindow ("IS machine51")\n'))

The error says it all. You need to indent anything you want to use in your ‘if’ statement:

 if name=='Operator51':
    nav.openWindow ("IS machine51")

In case it isn’t clear from the other comments, indentation is how python identifies the boundaries of nested code blocks, for if statements and loops and exception trapping–everything. Proper indentation is mandatory in python.