LogOn
This function either logs on a specified user or displays a Log On dialog.
Function | Group | Execution | Windows | Embedded | Thin Client | Mobile Access |
---|---|---|---|---|---|---|
LogOn | Module Activity | Asynchronous | Supported | Supported | Supported | Supported |
Syntax
LogOn(optStrUsername,optStrPassword)
- optStrUsername
- The name of the user to log on.
- optStrPassword
- The specified user’s password.
optStrUsername and optStrPassword are optional parameters. If they are not specified, then the project will instead display a Log On dialog, to prompt the station’s current operator — whoever it is — to log on.
Returned value
This function returns the following possible values:
Value | Description |
---|---|
0 | Error (e.g., username or password is invalid) or cancellation. |
1 | Success. |
Notes
The following limitations also apply to how the function can be used in project screens in Mobile Access:
- The function cannot be called from the sub-routine Screen_OnClose in the Screen Script; and
- You should avoid creating a script that both shows a dialog box (e.g., a message box that is shown using the VBScript function MsgBox or the IWS built-in function ShowMessageBox) and opens or closes a screen. The Mobile Access web interface can display only one screen at a time, and opening a new screen will automatically close the previous one. Depending on the order of execution, this can lead to unexpected behavior such as a dialog box being orphaned or not being shown at all.
Examples
Display a Log On dialog:
LogOn()
Log on username Albert with password EMC2:
LogOn( "Albert", "EMC2" )