"with timeout of 5 seconds" problem

The following code returns true:


set the_var to "timed out"

try
	with timeout of 5 seconds
		myHandler()
	end timeout
on error
	the_var
end try

on myHandler()
	delay 10
	return true
end myHandler

Can anyone explain to me why that is? How can you tell if the operation exceeds the limit of 5 seconds? This makes no sense to me. What’s the point of “with timeout” if it doesn’t fire anyway?

Thanks for any help.

‘With timeout’ is intended to avoid timeoutout errors, not to induce them. This from the AppleScript Language Guide:

As you can see, timeouts only apply under favourable circumstances with scripted applications that are not the application actually running the script. In your case, it’s the script (application) that’s carrying out the delay. It’s not waiting for another app to confirm the completion of a received command.

Do you have a particular end in mind here, or are you just experimenting?