Originally Posted By: ShaneEP
Or if you dont want to set the novars and nomacros options to ON, this also seems to return the correct error.

 Code:
? tryCommand("use c: '\\fileserver\share1'", 3)
? tryCommand("use c: '\\fileserver\share1'", 3)
? tryCommand("use c: '\\fileserver\share1'", 3)
get $

function tryCommand($command, $howoften, OPTIONAL $interval)
   DIM $i
   DIM $ERROR
   $i = 0
   if $howoften < 1 
      $tryCommand = -1
      return $tryCommand
   endif
   do
      $ = execute($command+" $$ERROR = @@error")
      if $ERROR = 0 
         $tryCommand = $ERROR
         return $ERROR
      endif
      if $interval <> ""
         sleep $interval
      endif
      $i = $i + 1
   until $i = $howoften
   $tryCommand = $ERROR
endfunction


thanks for sharing this with me! This works great! I didn't necessarily wanted to change the kix options, since this script-snippet of course is just a small segment in the greater scheme of things.

Now I get proper return codes and will probably be able to find the root of the problem.

Thanks again to everybody for your help and sharing your thoughts and ideas with me.