Per FMP documentation it is supposed to retain the found set of the original window, but it is not.
The FMP documentation says:
A new window has the same layout, same table, same , and same current record as the original window.
Instead, the new window is opening, but is finding all records, thus eliminating my found set which I wish to work with in this new window.
Now the reason for this is that on the main file I have an "on open" script trigger which includes a "find all records" script step.
So, is the documentation wrong, incomplete, or buggy?
You can add a $$var to your script triggers (or at least that one) and let them exit if that flag is set:
If [ $$NOTRIGGER ]
Set Variable [ $$NOTRIGGER ; "" ]
# [ original code … ]
Then open the new window with a script
Set Variable [ $$NOTRIGGER ; 1 ]
+1 for erolst's suggestion.
There is something else to check: Is the script trigger "OnFirstWindowOpen", or is it "On WindowOpen"? It sounds like you want the "OnFirstWindowOpen", but the behaviour you describe is more like "OnWindowOpen".
Sorry for the long delay in response. I was basically misinterpreting what was happening. The "onFirstWindowOpen" was working properly, but it was a script step that was revealing all records.
In any event, I did find a solution using ValueCount(WindowNames). Basically, if that count is less than 2, I open a new window. If it is >2, I open a new window, but close the previous window to keep things tidy.
Erolst's script did work, but I find the ValueCount is working as needed.