Repeating until dialog

I am trying to build an alarm script but i am having a problem. Can’t seem to stop the loop, thru the eyes of a dialog.

display dialog "Your Timer Has Gone Off!" buttons {"Turn Off"} default button 1
repeat with i from 1 to 100
	do shell script "open -a 'Play Sound.app' Users/me/Desktop/bigdeal.mp3"
	delay 10
end repeat

After hitting the default button i want the repeat loop to stop.

Any help much appreciated!

Model: G5 Moterola
Browser: Safari 531.21.10
Operating System: Mac OS X (10.5)

I’m afraid what you want to do is not an option. When you post a dialog box, the script stops waiting for a response unless you set it to time out automatically. Further, there is nothing in your loop to stop the loop; no escape from it.

You need something like this:

set TOff to ""
repeat with i from 1 to 100 -- You could make this just repeat; an infinite loop and still stop it.
	if button returned of (display dialog "Your Timer Has Gone Off!" buttons {"Turn Off"} default button 1 giving up after 3) is "Turn Off" then exit repeat
	beep 3
end repeat

That’s perfect! Thanks Adam!

Did you know you can play sounds with the afplay-command? Built-in in MAC OSX

choose file
do shell script "afplay " & quoted form of (POSIX path of result)

Hope it helps,
ief2

ief2 told you about the afplay-command that is Built-in to OS X.
Thought you might want to give it a try.

set audioFile to "/Users/ME/Desktop/bigdeal.mp3"
set thePID to do shell script "osascript <<-EOF &> /dev/null & echo $!
repeat
do shell script \"afplay -t 100000 " & quoted form of audioFile & "\"
delay 10
end repeat
EOF"
tell me to activate
tell me to display dialog "Your Timer Has Gone Off!" buttons {"Turn Off"} default button 1 
try
do shell script "kill " & thePID
end try
try
do shell script "killall afplay"
end try

Tom