发布于 2012-11-21 18:22:02
2楼
Option Explicit
Function action
Dim user
user = HMIRuntime.Tags("@CurrentUserName").Read
Select Case UCase(user)
Case "甲班" //这是系统登录的用户名称
HMIRuntime.Tags("甲班已登录").Write 1 //甲班已登录是建的二进制变量
HMIRuntime.Tags("乙班已登录").Write 0 //为什么不行呢???还希望奇侠能详细解答!谢谢
HMIRuntime.Tags("丙班已登录").Write 0
Case "乙班"
HMIRuntime.Tags("乙班已登录").Write 1
HMIRuntime.Tags("甲班已登录").Write 0
HMIRuntime.Tags("丙班已登录").Write 0
Case "丙班"
HMIRuntime.Tags("丙班已登录").Write 1
HMIRuntime.Tags("甲班已登录").Write 0
HMIRuntime.Tags("乙班已登录").Write 0
Case Else
HMIRuntime.Tags("甲班已登录").Write 0
HMIRuntime.Tags("乙班已登录").Write 0
HMIRuntime.Tags("丙班已登录").Write 0
End Select
End Function