Prevent Application to Close

Hi Folks,

is it possible to prevent an application to be closed by the user?

the situation is the following:

My application is using the application “Internet Connect” - if the application “Internet Connect” is not running,
then I get a “ns error 4”

Thanks for any input…

Best Regards,

Stefan

Hi Stefan,

no, it isn’t, but you can check, whether “Internet Connect” is running,
and launch it, if necessary

tell application "System Events"
	if not (application process "Internet Connect" exists) then launch application "Internet Connect"
end tell

You probably watn to reconnect. I can’t remember how I used to script this, but there are a lot of script examples on the internet. You would want to place it in an idle handler or something that monitors the connection.


on idle
	-- check status or state of internet connect
	-- if not connected then connect
	return 5 -- every 5 seconds to check
end idle

gl,

Hi Stefan, Hi Kel,

thanks for your feedback - works perfect! I used Stefan´s hint…

Best regards,

Stefan