Hi,

Newbie here, so please be kind

I have a small problem which I am trying to work out, (and think logally the best way to attack the structure.)

Once a week, I generate a file that reads a file and outputs a new file using this code (with lots of help from a previous helper . )
 Code:
 
$InputFile=("C:\Output2.txt")	;Modify location for path
$OutputFile=("C:\List.txt") 	;Modify location for path
$Pick=5		;Select the number of lines you want
Break ON

$fso = CreateObject("Scripting.FileSystemObject")
$txt = $fso.OpenTextFile("$InputFile",Not 0)
$Array=Split($txt.ReadAll,@CRLF)
$txt.Close

$=SRND(@MSECS)
$=RND(0)

For $Output=1 To $Pick
	$Array=Split(udfSqueeze(Join($Array,@CRLF),@CRLF),@CRLF)
	$iChose=IIf(UBound($Array)>0,RND(UBound($Array)),0)

;		"Selection "+$Output+": "+$Array[$iChose]+@CRLF		;Debug to show on screen what is selected

	$ = Open(1,"$OutputFile",5)					;Generating output file list
      $ = WriteLine(1,$Array[$iChose]+@CRLF)	
	
	$Array[$iChose]=""
	
Next
$ = Close(1)

Function udfSqueeze($s,$q)
	$udfSqueeze=$q+$s+$q
	While InSTR($udfSqueeze,$q+$q)
		$udfSqueeze=Join(Split($udfSqueeze,$q+$q),$q)
	Loop
	$udfSqueeze=Split($q+$udfSqueeze+$q,$q+$q)[1]
EndFunction



Now, when I run a second job a week later, it generates a new output file. this output file MAY have the same entry in it as the previous week, so I want it to skip that entry and continue picking another entry to write into the file.

So, if the first week file generates
Word1
Word2
Word3
Word4

and the second weeks file has Word3 in it, I need the new output file to skip Word3 and continue picking a new word instead.

Does that make sense?

I am thinking about reading in the first file into an array, then reading the second file, select a random line in that file, check it, if not in the array, write the output, otherwise, discard that line, then pick another one, check it etc until I have my five lines in it.

Does that make sense? And does my method of using an array make sense? Or is there a better way to do it.

All help appreciated \:\)