You may need to update your OnRecordCommit script to check a global variable and to not run when a specific value is set to the variable.
Then you can use the Set Variable script step, to turn this OnRecordCommit triggered script "off", do your new window and then use another set variable step, to turn it back "on".
Your OnRecordCommit triggered script might then look like this:
If [ Not $$CommitDisabled ]
//Your current script steps go here
Your new window script then becomes:
Set Variable [$$CommitDisabled ; Value : True ]
Go To Layout
Set Variable [$$CommitDisabled ; Value : False ]
Yes, it is what I thought.
The posted issue can be solve by following method. But, I have issue.
I always need Main window, which is on the desktop, and a working window, which is on the off screen invisible area, to do some data finding , sorting, .... I would like to keep the working window open all the time before user exit application. How do I know the AP is exit by user, by clicking the close button on the left-top corner of my main windows. I need to close the working windows when user close main window.
Do you have FileMaker Advanced?
If so, you could write your own Close Window script and use Custom Menus to put it in place of the normal close window action. Your script can then close the working window whenever the main window is also closed.
Yes, I have FMP Advance. I do not use custom menu. I will try. Do you mean I can have a script for "exit AP" by custom menu and it will be trigged by my Main window left-top close button also?
Closing the Main Window and exiting the application are two different actions.
When you exit the application, the working window will close automatically--so you don't need anything extra here.
You'd write a script to take the place of close window that checks the name of the window being closed to see if it's the main window, if so it then closes the working window also.
Where can I set the trigger of the close window? Yes, as long as I can trig a script by closing any window, I do handle it.
Clicking the close box in the corner of the window is the same as selecting Close Window from the File Menu. Thus, you modify the Close Window option in the File Menu to run your script instead and this script will run when you select it from the file menu or when you click the window button to close it.
I got it. I will try it. Thank you.