I’m working on a script that uses this flow:
set attempts to 0
repeat
display dialog
repeat
try
display dialog
set attempts to attempts+1
end try
end repeat
end repeat
On the first dialog, the default “cancel” and “ok” buttons are there. The “ok” continues the script automatically as expected, and the “cancel” returns error number -128 and ends the script as expected. The editor shows the result “error ‘User canceled.’ number -128”.
However, during the second dialog, which is scripted the same way, the “ok” button works (i know this because the “attempts” value increases), but the “cancel” button keeps me on the same dialog endlessly (if “cancel” continues to be attempted) without adding to the “attempts” count. The events shown in the editor show that error -128 is being returned, but it never causes the script to end. Anybody know why, or how I can fix this so that the cancel works?
(Or should i just set it up manually with “cancel” and “ok” buttons? I hesitate to try this because i only know how to make it “exit repeat” upon the “cancel” being selected, but my understanding is that that would only exit the interior repeat.)
AppleScript: 2.1.1
Operating System: Mac OS X (10.6)