I am running the following script fine, but when it reaches the end of the UID.TXT file, I get an ARRAY REFRENCE ERROR. The script doesn't seem to understand that there is no more lines to process in the txt file.
Code:
If NOT Open(1,"\\spghmbrsrv02\soft$\UID.txt")
If NOT Open(2,"\\spghmbrsrv02\soft$\UIDFail.txt",5) ;1 for Create file and 4 for open in write mode = 5
$UID=Split(ReadLine(1),"~")
$USERNAME=$UID[0] ;6-1-1 UID
$USRNAME=$UID[1] ;3-4 UID
While $UID[0]
Color w+/n
?" Moving files from "Color y+/n"$USERNAME "Color w+/n"to "Color y+/n"$USRNAME"
?" "
;Move "\\spghmbrsrv01\private$\$USERNAME" "\\spghmbrsrv01\private$\$USRNAME" /h/s
If @ERROR > 0
Color r+/n
?"Failed!"
WriteLine (2,$UID+Chr(13)+Chr(10)) ;writes the failed pc to the pcfaillist.txt
Else
Color g+/n
?"Done!"
EndIf
$UID=Split(ReadLine(1),"~")
$USERNAME=$UID[0] ;6-1-1 UID
$USRNAME=$UID[1] ;3-4 UID
Loop
$=Close(1)
$=Close(2)
EndIf
Thanks in advance for any help you can give ~ Trox
_________________________
Thanks ~ Trox
John Wayne's not dead - he's frozen.
And as soon as we find the cure for cancer
we're gonna thaw out the duke and
he's gonna be pretty pissed off!
~Dennis Leary~