Is this script set to run when the file is opened?
If not, just force quit Filemaker and re-open your file.
If it is, is there another script in this file other than the one that traps you in this loop?
If so, you can create a new file and use Perform Script in a script in this file to run some other script besides the looping script. This will open the file in the background without performing the On Open script. You can then select your file from the Windows menu, (Show window option) and get your file open without being trapped in a loop.
PS. saving lots of copies while you work on a database file is a good habit to get into. That way, if your file gets totally messed up, you can revert to a copy that is only an hour or even a few minutes old and not have to discard as much work. It also allows you to recover from "developers remorse" when you make a major change to your file and then regret making the change.
The script was indeed set to run when the file was opened.
By creating a new file/database I could run another script in the file and so reach the problem script without running it.
It worked, and thanks for your advice.