repeat end repeat

hello

i have a problem with my script needing a loop repeat end repeat i can’t stop my script once i have start it

can you help me

i put my script on Xcode for a visual interface but as i can’t quit it without force to quit application is not good enought

thanks

sorry for my french english

I am not sure if I understand correctly, so correct me if I am wrong. The way I see it, you want your application to do something over and over again (loop) until you quit it. But if you put this inside a repeat - end repeat, you cannot quit your application. Am I right?

If yes, then what you should do is to remove the repeat - end repeat from the script, and put its contents inside an on idle handler. That way, your application will repeat doing whatever is inside the on idle hander, but it is also listening for user actions so you can quit it.

how do you do this ?
what is the command line ?

thanks

Instead of this:

on launched
-- do something
repeat
-- do something else
end repeat
end launched

You should have something like this:

on launched
-- do something
end launched

on idle
-- do something else
end idle

what could you made with my script ?
it’s script it perhaps bad writing but it work well except i can’t quit it even if i put a stop button the script doesn’t take it has an information
the script verify your internet connexion to be sure active then send with a predefined timing an mail with your ip

this script was made to always have an update send ip to connect my imac by ftp or vnc when i’m not at home

thanks

on clicked theObject
repeat
tell application “Internet Connect”
activate
connect
delay 20
end tell
set b to content of text field “input” of window “SendIP”
set c to b * 3600
set d to c / 10
set e to content of text field “mail” of window “SendIP”
set contents of text field “output” of window “SendIP” to b

	set response to do shell script "/usr/bin/curl [url=http://checkip.dyndns.org/]http://checkip.dyndns.org/"[/url]
	set ip_address to response
	set h to "" & ip_address ¬
		
	set AppleScript's text item delimiters to ":"
	set i to the second text item of h
	set j to i
	set AppleScript's text item delimiters to "<"
	set k to the first text item of j
	tell application "Mail"
		activate
		set composedMessage to (a reference to (make new outgoing message ¬
			at the beginning of outgoing messages))
		tell composedMessage
			make new to recipient at beginning of to recipients ¬
				with properties {address:e}
			set the subject to "votre ip par SendIP"
			set the content to k
		end tell
		send composedMessage
	end tell
	set contents of text field "ip" of window "SendIP" to k
	set contents of text field "output" of window "SendIP" to b * 60
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 10 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 20 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 30 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 40 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 50 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 60 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 70 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 80 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 90 / 100)))
	delay d
	tell progress indicator "progress" of window of theObject to increment by 10
	set contents of text field "output" of window "SendIP" to (b * 60 - ((b * 60 * 100 / 100)))
	tell progress indicator "progress" of window of theObject to increment by 10
	tell progress indicator "progress" of window of theObject to increment by -100
end repeat

end clicked