2008年8月19日 星期二

使用者名稱的比對函數

這範例可以『作 一個使用者名稱的比對』,當 FindMatch = TRUE 時 針對該使用者做出警示工作內容上為完成部分,或是更多的權限控管。
----------------------------------------
%Include "LSCONST.LSS"
' Declare an array of Strings and initialize it with some
' names.
Dim theNames(1 to 6) As String
theNames(1) = "Alex"
theNames(2) = "Leah"
theNames(3) = "Monica"
theNames(4) = "Martin"
theNames(5) = "Elizabeth"
theNames(6) = "Don"

Function FindMatch(yourName As String) As Boolean
Static callCounter As Integer ' To count the number of
' calls to FindMatch.
Dim counter As Integer ' Loop counter.
FindMatch = FALSE
For counter% = 1 to 6
If yourName$ = theNames(counter%) Then
FindMatch = TRUE
Exit For ' Exit from the For loop now.
End If
Next

' If the user enters an invalid name,
' increment callCounter%.
If FindMatch = False Then callCounter% = callCounter% + 1
' After three consecutive invalid names, terminate the script.
If callCounter% = 3 Then
Print "Go away, friend."
End ' Terminate execution.
End If
End Function
--來源 Lotus Notes Designer Help

沒有留言: