I started Kix'cripting 2 days ago and wanted to say thanks guys for your indirect help on my issue using an array within a UDF.
My code didn't seem to work until I defined my array variable as Global. Example below:
Break On Global $LogArray[100]
$X = 0 $LogFile = "C:\KixLogFile.txt"
SendToLog("This is Line 1.") SendToLog("This is Line 2.")
WriteToLog() Quit
Function SendToLog($LogEntry) $LogArray[$X] = $LogEntry + @CRLF $X = $X + 1 EndFunction
Function WriteToLog() Del $LogFile If Open(1, $LogFile, 5) = 0 For $index = 0 to ($X -1) WriteLine(1, $LogArray[$index]) Next EndIf $ = Close(1) EndFunction
|