ok...this script is kicking my 'tail'!!!
i admit it...i don't understand arrays. if i did, this would probably be easy to solve. can you please help me???
got the function array out of bounds error resolved. however, now another piece is out of bounds and for the life of me, i don't know why...it used to work and now it doesnt.
function code:
Code:
;################################################
;## Function to Tail the file (unix style)
Function Tail($file,optional $lines, optional $skip)
dim $fso,$f,$fs,$i,$all
if not $lines $lines = 1 endif
if not $skip $skip = 0 endif
$fso = CreateObject("Scripting.FileSystemObject")
$f = $fso.GetFile($file)
if @error exit(2) endif
$fs = $f.OpenAsTextStream(1)
if $skip $fs.Skip($skip) endif
$all = split($fs.Read($f.size-$skip),@crlf)
if $lines = -1
; DONT NEED redim preserve $all[ubound($all)-1]
$tail = $all
exit(0)
endif
dim $out[$lines]
for $i = ubound($all)-$lines to ubound($all)
$out[$i-(ubound($all)-$lines)] = $all[$i]
next
redim preserve $out[ubound($out)-1]
$tail=$out Exit(0)
EndFunction
the portion of the script that is calling the function
Code:
for each $line in tail($tmpFile,-1,42)
$cPerms=Split($line,':')
$uPerms=$cPerms[1]
$uPerms=trim("$uPerms")
if $uPerms <> $perms1
writeprofilestring($file,@wksta,'administrators',$uPerms)
else
if $uPerms <> $perms2
writeprofilestring($file,@wksta,'administrators',$uPerms)
endif
endif
next
the script is causing an error, array reference out bounds
Code:
$sPerms=$aPerms[1]
what I don't understand is this 'was' working and then, it seems like all of a sudden it does not want to work anymore....and i am lost.
your expertise is appreciated