A couple of observations - may not fix your problem, but I've found before that you may get failures on lines where the error is in fact elsewhere in the script.

  • Quit takes an optional parameter. Sometimes it is not so optional and causes errors [Wink] . Get into the habit of returning an exit code i.e. Quit 0. The "EndIf" following the Quit may be interpreted as the exit code.
  • Your CASE statement is not constructed correctly. Each element should be an expression. I think you mean:
    code:
    Case $Pos=3 OR $Pos=5 OR ...