Hi Maia,
It is actually quite easy to track user logins and logouts in Citect. In the Citect Project Editor, drop down menu "System" -> "Users" if you extend this form by pressing "F2", there is an "Entry Command" and an "Exit Command". From here you can run Cicode to pickup the user who has logged in and write it to disk or what ever.
An example of what you can do is shown below. This is a bit of code that I use in some of my projects for logging user information to disk and screen.
Hopefully this is of some use to you.
Cheers,
Andrew
** NOTES:
**
** 1. Traps User Name, Date and Time of Login.
** 2. Traps User Name, Date and Time of Logout.
** 3. Logs actions of Users.
**
*/
/*
** Declaration of Local Variables
**
*/
INT hDevice;
/*
** Function: UserLogOutInfo()
** Called From: Users Database in Citect Project Editor under "Exit Command"
** Use: Trap User Name, Date and Time of a user logout.
**
*/
FUNCTION UserLogOutInfo()
hDevice = DevOpen("UserLog",0) //Open Logging Device
DevWriteLn(hDevice,TimeToStr(TimeCurrent(),4)+ " "+ UserInfo(2)+", Logged Out."); //Write Data to Device
DevClose(hDevice); //Close Logging Device
CurrentUser(); //Call CurrentUser Function
END
/*
** Function: UserLogInInfo()
** Called From: Users Database in Citect Project Editor under "Entry Command"
** Use: Trap User Name, Date and Time of a user login.
**
*/
FUNCTION UserLogInInfo()
CurrentUser(); //Call CurrentUser Function
hDevice = DevOpen("UserLog",0) //Open Logging Device
DevWriteLn(hDevice,TimeToStr(TimeCurrent(),4)+ " "+ UserName+", Logged In."); //Write Data to Device
DevClose(hDevice); //Close Logging Device
END
/*
** Function: CurrentUser()
** Called From: UserLogOutInfo(), UserLogInInfo() and Initialise()
** Use: Displays The Name of the Currently Logged In User.
**
*/
FUNCTION CurrentUser()
SleepMS(500); //Provide Delay For User Data to Update
IF UserInfo(0) = "1" THEN
UserName = UserInfo(2); //If a user has logged in then display Current User Name.
ELSE
UserName = "No User Logged In"; //If no users are logged in then display "No User Logged In"
END
END
/*
** Function: UserLogAction("Action Text")
** Called From: Called From Various Buttons and Pages through the Project
** Use: Log Actions By Current User.
**
*/
FUNCTION UserLogAction(STRING s)
hDevice = DevOpen("UserLog",0) //Open Logging Device
DevWriteLn(hDevice,TimeToStr(TimeCurrent(),4)+ " "+ UserName+", "+ s +"."); //Write Data to Device
DevClose(hDevice); //Close Logging Device
END