tell application FileMaker; hide all open windows; end tell

What’s the syntax for telling FileMaker to make all windows of all open database files hidden?

I’ve got a scripted routine where users are supposed to complete all aspects of the task at hand. I’ve got SecureFM destroying nearly all of their menu commands aside from Cut/Copy/Paste, as well as keeping them from closing windows or accessing the status area, but savvy Mac users in the place, accustomed to dismal navigation tools in this ancient creaky old solution I inherited, take a window frame and drag it down to access visible windows behind it to go look up something and, often as not, never get back to where they started to finish the data entry task.

If all windows except the current one are hidden, they can’t do that (no Windows menu).

FileMaker 6, mixed OS 9 and OS X environment

(some Windows PC users too but PC users just don’t tend to reach behind their current & always maximized windows to get to others. Their OS may be capable of multitasking but the GUI discourages staring at more than one task at a time)

You can set the visible of a window to false in FileMaker.

tell app "FMP"
set the visible to every window whose name is not "Name of window you want" to false
end tell

You can flip between windows as the user progresses through the data entry script. The window still is open when you set the visible to false, it’s just hidden. Strange that they would have a “show” verb, but not a “hide.”

tell app "FMP"
open database "A.fp5"
--do stuff
set the visible of window "A.fp5" to false
open database "B.fp5"
--do some more stuff
set the visible of window "B.fp5" to false
set the visible of window "A.fp5" to true
-- do yet more stuff
end tell

If you have only two databases, you can use the index. More than two makes using the index too complex, using names of windows is easier.

Dennis Cox:


tell app "FMP"
set the visible to every window whose name is not "Name of window you want" to false
end tell

OS X Script Editor: AppleScript Error: FileMaker Developer got an error: Event not handled. (the phrase the visible of every window whose name is not “JobTicket_.fp5” is highlighted in Script Editor).

OS X FileMaker ScriptMaker, Perform AppleScript: “Object not found. (Error -10006)”.

OS 9 FileMaker ScriptMaker, exact same file exact same script: Exact same error msg.

OS 9 Script Editor: Same error message as the OS X Script Editor.

leaving out “whose name is not JobTicket_.fp5” doesn’t help either.

So something’s wrong with the syntax you provided.

I’m currently experimenting with some form/variant of

tell the application "FileMaker"
repeat for every open document
tell the current document
do menu item named "Hide Window" of menu named "Window"
end tell
end tell

or even:

tell the application "Filemaker"
repeat for every open document
do script "Hide the Bloody Freaking Window"
end tell

I’m always not quite right on syntax the first ten dozen times I try to do these things. [/i][/b]. At any rate it’s not working yet.

OK, I found a solution. Still smells like a workaround but I let FileMaker set a global to databasenames, which gives me the names of all my open files (i.e., windows under FmPro 6) and then I loop through a routine that sets a second global to just the first file listed in databasenames, snips that name from the first global with Substitute(firstglobal, ThatFileName, “”), then sets a third global to

"tell the current application"&"¶"&
"set the visible of window "&Quotemark&secondglobal&Quotemark&" to false"&"¶"&
"end tell"

and performs that third global as an AppleScript, ending loop when the first global empties out.

I KNOW there’s a simpler AppleScript syntax that does not require me to ever obtain a list or count of open databases, but this works.

Try this:

[This script was automatically tagged for color coded syntax by Convert Script to Markup Code]

Inside a Perform AppleScript step you don’t need or want the “tell Filemaker” block.

But FileMaker 6 seems to go blind about the windows; the count is 0 so it stops working. I found that a Freeze Window or Refresh Window step first seems to knock it upside the head so it remembers that it has windows to count.

FileMaker 7 seems to always work. But it has its own built-in Open and Close Windows commands.