Level: Any, Version: FM 8 or later

Meaningful Window Names

How many times has this happened to you? You want to view a number of separate layouts, each in its own window, and as I mentioned the other day, if you’re using FileMaker 11 you can pop them all open at once, like this:

But, regardless of how you spawn the windows, after doing so, here’s what you see.

Hmm… those window names aren’t terribly useful are they? Normally you don’t want a window name to be too specific, because the underlying layout is apt to change. But during development, it’s quite common to want to see multiple layouts simultaneously, each in its own window. And in that case, wouldn’t it be nice if the window name showed something useful, for example, the TO (table occurrence) and layout name?

Of course, there’s nothing to stop you from writing a one-line script to make this dream come true, using the Set Window Title script step:

Invoking this script step will change a window name from, for example, “GT_Interface – 6” to “[INV]   invoices – list – general”. Much better don’t you think? But the thought of having to painstakingly click on each window and invoke that script five more times… whew, I get tired just thinking of it.

There must be some way to rename all windows at a single shot, no? As a matter of fact there is — provided they all belong to the same file. You can write a looping script like so…

…and quicker than you can say “Wozniak”, here’s what you get. Well worth the effort, wouldn’t you say?

P.S. note that the Select Window step in the looping script has the “current file” option checked:

(There’s no point in selecting windows belonging to other files, because a script in file A cannot modify a window in file B.)

Finally, be aware that if your solution is coded to expect a certain window name, and you change that name, and then run a script that was relying on the original window name, the consequences could be quite unpleasant. As always, caveat scriptor.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.