![]() |
||
|
This board is for PLC Related Q&A ONLY. Please DON'T use it for advertising, etc. |
||
| ||
New Here? Please read this important info!!!
|
|
#1 |
|
Member
![]() Join Date: Oct 2009
Location: Manchester
Posts: 2
|
WinCC Flexible 2008
Hi everyone, new to the site but just want to say hi first.
Ive been trying to find a way to set a tag to 1 when logged in as a admin or another high level user and keep that same tag 0 when logged in as just an operator. Ive tried writing a script but it doesnt seem to work, any ideas would be great!! Thanks!! ![]() GetGroupNumber SmartTags("group number") If SmartTags("group number") = "9" Or "2" Then SetBit SmartTags("Engineering Bit") Else ResetBit SmartTags("Engineering Bit") End If when i run the script it just sets the bit as -1 in the tag simulator thing and wont change? Numbers 9 and 2 are the higher level Groups and anything else (in my case number 1) is the operator group number. |
|
|
|
#2 |
|
Member
![]() Join Date: Feb 2007
Location: Leuven
Posts: 807
|
Exactly how is this script triggered?
Where does "group number" come from? |
|
|
|
#3 |
|
Member
![]() Join Date: Oct 2009
Location: Manchester
Posts: 2
|
im triggering it off the login button and some menu buttons, the group number as far as im aware gets written to the tag automatically after log in.
|
|
|
|
#4 |
|
Lifetime Supporting Member + Moderator
|
Do not make a script for this !
Do it this way in stead: Device Settings .. Scheduler. Add a Job, to be triggered on the event "change user". Add the following functions to the job: "GetGroupNumber", assign to an internal integer tag. "GetUserName", assign to an internal string tag. "TraceUserChange". You can now use the tags to show the current level and name of the user.
__________________
Jesper
|
|
|
|
#5 |
|
Member
![]() Join Date: Aug 2005
Location: Arkansas
Posts: 1,085
|
Thats a cool idea but I have a question
Does the "change user" event run after the log in timeout? I know it should run when the user logs in but by default the user will be logged out after 5 minutes. If it does run on log out what values does it return?
|
|
|
|
#6 |
|
Lifetime Supporting Member + Moderator
|
It does run at timeout. Because the user is logged out.
The userlevel or "group" returned is "0" (zero).
__________________
Jesper
|
|
|
|
#7 |
|
Member
|
This is something I can use as well!
Jesper, do you know off-hand how long the String for the User Name can be? I can't find it anywhere in the help files.
Edit: While we're on the subject, how do you enter the DB adress in the String compare block (FC10 EQ_STRING). Looking at String functions I've used before it shows up as P#DB2.DBX40.0, but if I try to enter that, it stays red. Trying to enter it symbolically as '"HMI_DB".User_Name' didn't work either. Another of these things you only do every couple of years and always forget how it works!
Last edited by RMA; October 15th, 2009 at 10:41 AM. |
|
|
|
#8 |
|
Lifetime Supporting Member + Moderator
|
Unfortunately I do not know how long the username can be.
Longer than what practically makes sense I guess. Comparing strings by entering the symbolic names seems to work for me. Maybe save the DB, shutdown the LAD/STL/FBD editor, and try again ?
__________________
Jesper
|
|
|
|
#9 | |
|
Member
|
Quote:
I've settled on thirty characters for the String, hopefully that will be enough for most people! |
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Topics
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Lost window in wincc flexible 2008 | dean_ham | LIVE PLC Questions And Answers | 9 | October 9th, 2009 06:42 AM |
| Drawings in WinCC flexible 2008 | thorgalrose | LIVE PLC Questions And Answers | 6 | August 4th, 2009 03:52 AM |
| WinCC Flexible Bug (ProAgent) 2008 ... ? | Combo | LIVE PLC Questions And Answers | 3 | July 29th, 2009 12:13 PM |
| Connecting wincc flexible 2008 to PLCSIM | PDS | LIVE PLC Questions And Answers | 1 | July 7th, 2009 09:52 AM |
| WinCC 2008 Flexible issues | JOLTRON | LIVE PLC Questions And Answers | 3 | March 25th, 2009 05:45 PM |