I have a file which has an OnFirstWindowOpen script. It is two lines:
set zoom to 150%
go to layout [mainscreen]
The file was closed on a layout which has a script trigger OnRecordLoad. It has one line:
go to layout[by name calculation]
When the file is opened there are two script triggers activated: OnRecordLoad and OnFirstWindowOpen.
This is what happens:
- [onFirstWindowOpen script is triggered]
- [OnRecordLoad script is triggered]
- zoom is set
- layout is switched
- [onFirstWindowOpen script is complete]
- Error occurs because the OnRecordLoad script is being run in the wrong context.
The documents clearly state that: when multiple script triggers are activated by the same action, the script triggers activate in the following relative order: 1. OnFirstWindowOpen 2. OnWindowOpen 3. OnLayoutEnter 4. OnModeEnter 5. OnRecordLoad , etc
OnWindowLoad has changed the context and turned the onRecordLoad script into a loose cannon. The record that triggered the script is from a different TO. The record receiving the onRecordLoad script has no idea what is happening.
The attached file shows the problem clearly. Instead of tidying up data in a utility table the script destroys data in another table.