How about this:

code:

Del "C:\Apps.txt"

Shell "%ComSpec% /c %WinDir%\Kill.exe >C:\Apps.txt"

$Programs = ""

$Result = Close(1)

If Open(1,"C:\Apps.txt") = 0
$App = ReadLine(1)
while @ERROR = 0
select
case instr( $App , "WinWord.exe" )
$Programs = "$Programs" + "Microsoft Word" + $LineBreak
case instr( $App , "Excel.exe" )
$Programs = "$Programs" + "Microsoft Excel" + $LineBreak
case instr( $App , "PowerPnt.exe" )
$Programs = "$Programs" + "Microsoft PowerPoint" + $LineBreak
case instr( $App , "MSAccess.exe" )
$Programs = "$Programs" + "Microsoft Access" + $LineBreak
case instr( $App , "IExplore.exe" )
$Programs = "$Programs" + "Microsoft Internet Explorer" + $LineBreak
case instr( $App , "msimn.exe" )
$Programs = "$Programs" + "Microsoft Outlook Express" + $LineBreak
case 1
; none of the above, no addition to $programs
endselect
$App = Readline(1)
Loop
Endif

$Result = Close(1)

If $Programs <> ""
$Result = MessageBox("All programs must be Closed before Logging Off!" +
$LineBreak + $LineBreak + "Close the following programs before Clicking on 'OK'" +
$LineBreak + $LineBreak + "When you have finished, Click on OK and Select " +
$LineBreak + "Logoff from the Start Menu" +
$LineBreak + $LineBreak + "$Programs","System Information" , 4160)
Exit
Else
$Result = MessageBox("You will now be Logged Off the Network","System Information" , 4160 , 10)
Endif


I have changed all the IF statements to a SELECT-CASE statement. Also the $apps=readline(1) should be at the end of the WHILE @ERROR=0 - LOOP loop.

The condition is checked when the LOOP command is reached. If you do a IF-ENDIF statement AFTER you do the READLINE, the @ERROR code returned will be the error code of the IF-ENDIF statement and NOT of the READLINE statement.

If you want to test this code, click on the edit-icon (pencil and paper) above this post and cut-and-paste the lines between CODE and /CODE.

------------------
Greetz,

Roger the Young
------------------------
The code is out there...
------------------------
http://home.wanadoo.nl/r.s.m.s.dejong/Kixtart

------------------------

[This message has been edited by DrillSergeant (edited 24 January 2001).]

_________________________
The Code is out there