So I have this script that opens up a csv file with a users sid and then a 5 digit id that is then set as a environmental variable for a legacy app.

 Code:
;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


What I would like to do is rather than Warn the users that not entry for them can be found is to create a new entry for them in a file increasing the incremental number.

Is this possilbe

Thanks


Edited by Mart (2011-08-31 11:14 AM)
Edit Reason: Please use code tags when posting code.