Break Off ; exit if BREAK is pressed
$Allow = 1 ; allow by default
; Change allow status based on time of day - never allow between 13:00-15:00
; TimeDiff returns the number of minutes between the current time and 15:00 of the current day
; This value will be between 120 (at 13:00) and 0 (at 15:00) during tht time range not allowed.
; Before 13:00, it will be greater than 120, and after 15:00 it will be negative, thus the following test
; You need to download and include the TimeDiff() UDF in your script
$TVal = TimeDiff('now', @DATE + ' 15:00:00', 'M')
If $TVal < 120 And $TVal > 0
$Allow = 0
EndIf
; Change allow status base on workstation
$Allow = IIf(Left(@WKSTA, 3) = 'LPC', 0, $Allow)
; Change allow status base on group
$Allow = IIf(InGroup('Elever', 0, $Allow)
; continue with other allow tests as appropriate, setting $Allow to 0 if not permitted
; Process exceptions to the rules
; Override the allow value if the day is not in the range
; All users are allowed at any time on Fri-Sun
If Not InStr('MONTUEWEDTHU', Left(@DAY, 3)
$Allow = 1
EndIF
; If $Allow is zero at this point, the user should not be permitted,
; so perform a logoff
If Not $Allow
Logoff(1) ; exit the script - brea
EndIf