still the same.

I call the function multiple time with the same command, like this:
 Code:
tryCommand("use e: \\fileserver\share1", 3)
tryCommand("use e: \\fileserver\share1", 3)
tryCommand("use e: \\fileserver\share1", 3)



Although the share gets connected successful, I always get a 0 return code. I don't get it, is the use command not supposed to throw an error if the letter is already in use?

this is the function now, ?-Output created for debug purposes:

 Code:
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
	?"Error is: "+$ERROR
	?"@ERROR is: "+@ERROR
	DIM $foo
	get $foo
	?
	
	
	if $ERROR = 0 
		$tryCommand = $ERROR
		return $tryCommand
	endif
	
	if $interval <> ""
		sleep $interval
	endif
	
	$i = $i + 1
until $i = $howoften

$tryCommand = $ERROR
return $tryCommand

endfunction








Edited by MartinAD (2012-05-18 01:51 PM)