adding a stop button to repeat


on clicked theObject
	start progress indicator "spinner" of window 1
tell application ""
set nTime to contents of text field "timeBox" of window 1

repeat nTime times

--stuff to repeat here

end repeat
end tell
	stop progress indicator "spinner" of window 1
end clicked


how would i add a stop button to this to stop repeating.

on clicked theObject
   start progress indicator "spinner" of window 1
tell application ""
set nTime to contents of text field "timeBox" of window 1

repeat nTime times

--stuff to repeat here

end repeat
end tell
  if theObject is equal to "stopbutton" then
exit repeat
 stop progress indicator "spinner" of window 1
end if
end clicked

try that

i want to stop the repeat not the spinner the spinner is fine jsut the repeat is the problem

well then edit accordingly. simple as that. i really should have let you figure that one out yourself. i gave you the one line of code you needed. (exit repeat)

on clicked theObject
   start progress indicator "spinner" of window 1
tell application ""
set nTime to contents of text field "timeBox" of window 1

repeat nTime times

--stuff to repeat here
end repeat
end tell
   stop progress indicator "spinner" of window 1
if theObject is equal to "stopbutton" then
exit repeat
end if
end clicked

thanks ! for the help but that sends it into a never ending repeat

no problemo amigo