Close Window

Closes the currently active window or any other window by name or UUID.

Options 

  • Current Window closes the active window.

  • Window Name or UUID specifies a window.

  • Current file only restricts matches to the current file (not selecting this option matches all available FileMaker Pro files).

Compatibility 

Product Supported
FileMaker Pro Yes
FileMaker Go Yes
FileMaker WebDirect Yes
FileMaker Server Yes
FileMaker Cloud Yes
FileMaker Data API Yes
Custom Web Publishing Yes

Originated in version 

6.0 or earlier

Description 

Closing the last window of a file closes the file and halts execution of the current script. Additionally, in Windows, FileMaker Pro exits when no other windows are open or hidden. In FileMaker WebDirect, closing the last window logs out of the current web session.

Notes 

  • For Window Name or UUID, this script step first searches for a window with a matching name. If none are found, it then searches for a window with a matching UUID. Using a UUID guarantees you select a specific window, even if multiple windows have the same name or if the window's name has changed. See the Get(WindowName) and Get(WindowUUID) functions.

  • Because window names aren't required to be unique, this script step will select the first window with a matching name. To select a specific window when multiple windows have the same name, use the window's UUID instead.

  • Window name or UUID selection is not case sensitive.

Example 1 

Goes to a related record in the Invoices table using the Print Invoices layout, prints, and closes the window.

Copy
Go to Related Record [ Show only related records ; From table: "Invoices" ; Using layout: "Print Invoices" ; New Window ]
Print [ Restore: Printer ; With dialog: Off ]
Close Window [ Current Window ]

Example 2 

Closes the current window if it is hidden.

Copy
If [ Get ( WindowVisible ) = 0 ]
    Close Window [ Current Window ]
End If

Example 3 

Closes the Invoice Details window if it is open.

Copy
If [ PatternCount ( WindowNames ( Get ( FileName ) ) ; "Invoice Details" ) ]
    Close Window [ Name: "Invoice Details" ]
End If