I was working on a database that linked a lot of data to other data, employing many join tables. It is a database about maintaining a library of video and audio recordings of art events. The idea is to allow researchers explore and move through Artists, Events, Media Assets, Groups and Programs easily. As a result, I decided to build it so that it opens window after window. The user can jump from an Artist to an Event, or Group. After a while the screen can get cluttered, so I wanted an easy way to clean up the screen and get the user back to basics.
A Google search brought me to this thread on FMForums on how to get the count of open windows in FileMaker. Here is a demo file of how I wrote the script in my database.
Demo File – Open a Bunch of Windows

1) Enter the number of windows you want to mess up your screen with.
2) Click the “Open a Bunch of Windows” button.
Too many windows

The screen will be populated with windows.
Click the “Clean Up Windows” button to return to a single window.

The key to the script is:
ValueCount(WindowNames(Get(FileName))
This function gives you a count of open windows. From there, I wrapped it in a loop that Closes all Windows, but that is set to halt if there is only a single window left on screen. If you have only one window to start with, the script halts before it gets going.

Posted on November 20, 2011
0