Playing with AppleScript I have found when you build a repeat
to increment through a block if you cancel it you have to close the script to be able to start over:
property foobar : 0
tell application "BBEdit"
activate
select insertion point before first character of text document 1
repeat
## some magic
end repeat
end tell
Is there a way on cancel you can reset the property
back to 0 in the script so that it can be rerun again? Also, when the repeat loop is ran and finished you still have to close the script to be able to rerun it, even after setting the foobar
back to 0 with set foobar to 0
. Research didn't show anything on Apple.se, SO, superuser or Apple discussion. How can you get the script to reset without having to close it?