what version of FileMaker, and which Operating System ? If you use the Windows drop-down menu to create a new window, do you get the same issue ?
I believe the wizard creates a script that is designed to run when you go to the layout (the script is attached to the layout by a script trigger).
So if you add script steps to open a window and go to the layout, it will run endlessly.
Sounds like you want to be able to run the script manually, so just remove the script trigger from the layout.
You will find this trigger inside Layout Setup.
You can also modify this script so that it only performs once if you really do want the script trigger to perform it.
1 of 1 people found this helpful
The wizard creates a script, but only if you tell it:
Notes and tips
When you create a report, you have the option of creating a script that will sort a report later in the assistant. The script simplifies the process of viewing and printing the report. The report must be sorted properly to display summary information, and it’s easy to forget which fields need to be sorted.
That would be the trigger assigned to the layout, right?
Yes, the script is optional and if you check the box "run script automatically", then it will be attached to an OnLayoutEnter script trigger.
Regardless of whether you check the box, the script looks like this.
Enter Browse Mode
Go to layout [ "My Report" ]
Sort Records [ Restore ; No Dialog ]
If you then decide to add a "New Window" script step to the beginning of the script, while also having the script running by OnLayoutEnter script trigger (such as if you had checked the "run script automatically" checkbox), then you're going to be in an endless loop.
The solution is simple. Go to layout mode and navigate to the report layout. Go to Layout Setup, and disable the script trigger.
But if you want to keep that trigger, you can do it this way:
If [ $TriggersOff ]
Set Variable [$TriggersOff ; value: True ]
#put your script here
Set Variable [ $TriggersOff ; value: "" ]
I've only seen this with $$TriggersOff. Is there a reason that one works and the other not?
p.s. I don't use the variable, because triggered scripts can be tightly controlled otherwise (passed parameter). Or in Debugger (FMP Advanced), use "Enable/Disable Script Triggers" option. But these are all as alternatives!
Windows 8, FMP 14
"Is there a reason that one works and the other not?"
I don't understand that question, what doesn't work?
"p.s. I don't use the variable, because triggered scripts can be tightly controlled otherwise (passed parameter)."
sorry but when a script trips a trigger, there are no parameters that can be passed. And using the debugger isn't going to keep a trigger controlled script from running when it shouldn't for the end user.
Jason, where do I go to change the script trigger?
Go to layout mode then navigate to the report layout. Go to Layout Setup, go to the Script Triggers tab, and disable the script trigger.