;Set the string for the filename
$UIDINFO = "c:\Codes2b.csv"
;Check it exists
If Exist ($UIDINFO) = 0
MessageBox ("Error1:Consultant ID File Does Not Exist."+ Chr(13)+
"Please contact IT Support on 1234, as you will not be able to log in,"+Chr(13)+
"You will now be logged off this system!.",
"WARNING MESSAGE", 48, 300)
Else
;Check if the file is of a size greater than 0KB
$UIDSIZE = GetFileSize($UIDINFO)
If $UIDSIZE = 0
MessageBox ("Error2:Consultant ID File Is To Small."+ Chr(13)+
"Please contact IT Support on 1234, as you will not be able to log in,"+Chr(13)+
"You will now be logged off this system!.",
"WARNING MESSAGE", 48, 300)
Sleep 10
EndIf
;Open Up The UID File
$rc = Open(1, $UIDINFO, 2)
$line = ReadLine(1)
;Search for a match for the user
While @ERROR = 0
$line = Split($line, ",")
If $line[0] = @USERID
$uid = $line[1]
EndIF
$line = ReadLine(1)
Loop
;Count the UID string and ensure its populated
$uid_length = Len($UID)
;If statmenet that logs the user off if the UID is not of a suitable length
If $uid_length = "0"
MessageBox ("Error3:No matching Consultant Code Found."+ Chr(13)+
"Please contact IT Support on 1234, as you will not be able to log in,"+Chr(13)+
"You will now be logged off this system!.",
"WARNING MESSAGE", 48, 300)
Sleep 10
Else
Set "CONS_CODE=$UID"
? "Found name with UID: " + $uid
EndIF