Hello,
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?
Thanks,
Mitchel Gommers
Hello,
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?
Thanks,
Mitchel Gommers
Hi Mitchel,
You sure can! Look under Project 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.
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.
test=system.tag.getTagValue("Sometag")
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 :
name=system.tag.getTagValue("[System]Client/User/Username")
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.
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.