Hi again,

i addedd the following function to my code:

 Code:
function tryCommand($command, $howoften, OPTIONAL $interval)
DIM $i
DIM $ERROR
$i = 0

if $howoften < 1 
	$tryCommand = -1
	return $tryCommand
endif

do
	$ERROR = execute($command)
	if $ERROR = 0 
		$tryCommand = $ERROR
		return $tryCommand
	endif
	
	if $interval <> ""
		sleep $interval
	endif
	
	$i = $i + 1
until $i = $howoften

$tryCommand = $ERROR
return $tryCommand

endfunction



The function "tries" to execute a passed command and is supposed to return the exit code.
You also have to tell the function how often it should try to execute the command and you can also define a interval between each execution.

for some reason, i only get 0 return codes. Even if I try to "use" a share that is already in use or a printer is not able to connect, I always get 0 as a return code.

I dont know why, maybe this behaviour is by design or I have done something wrong. Maybe you can share some ideas.

thanks for reading
Martin.


Edited by MartinAD (2012-05-08 09:22 AM)