in debug mode, you move very slowly, is that a factor?
In layout mode, scripts don't run.
1 of 1 people found this helpful
There have been a couple of threads recently about script issues that were solved by inserting pauses in scripts to give FM time to update indexes etc. This could be an issue with the particular script if it runs correctly when stepped through. The trick will be to work out where it is going wrong so you know where to insert the pause. Post the script itself if you want help working it out.
I had some issues with scripts running too quickly.
Add long pauses to find where the issue is and then shorten the pause as much as possible while still having the script work properly. Some of my pauses are only 0.3 seconds, but that is enought time for the record to commmit or the cache to dump or whatever it is that I need to wait on befor e the next step.
Another technique to find the problem part of a script is to insert breakpoints in your script in the debugger. That way you can run the script at full speed in the debugger, but it will stop at the breakpoints. When it stops you should be able to tell whether something is malfunctioning. If it has not, you can move on to the next breakpoint. As soon as you find a malfunction you know that the problem lies between this and the previous breakpoint. You can then narrow it down if needed. Soon you will be able to work out where to insert a pause.
Another technique to find the problem part of a script is to insert breakpoints in your script in the debugger.
It's even possible to insert conditional breakpoints (maybe some day we'll get an official, direct implementation):
If [ someCondition ]
# [ empty comment; add breakpoint here ]
and/or use the debugger's “Pause on error” option.