I haven't seen a UDF for it anywhere else, which surprises me, cause there are some frightenly complex things being done in Kix.

I've expanded the UDF a little, in case anyone cares to steal it:

function catcherror($errortext, $error, optional $seterror)
if $error <> 0 or $seterror <> 0
open(9,"c:\kix\@wksta.log",5)
writeline(9,"LIST OF VARS AND VALUES HERE")
close(9)
messagebox("$errortext","Script Failure",48)
del(c:\temp.bat)
$error = 0
$seterror = 0
exit
endif
endfunction

Note the addition of $seterror. This way, I can call the funciton as-is when the @error code is normal and if it's not, do some other simple test (if $var = "") and $seterror = 1.

I have another little issue here, though. I want the EXIT command to bail out of this KIX script, but all it seems to do is exit the function. Is there some other command I'm missing?

Shawn, can you give me any more background on that MS known limitation, just for shots and giggles?