Select Window

Specifies a window by name or UUID and makes it the foreground window.

Options 

  • Current Window brings the active window of the file that contains the script to the foreground.

  • 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 Partial
FileMaker Server Yes
FileMaker Cloud Yes
FileMaker Data API Yes
Custom Web Publishing Yes

Originated in version 

6.0 or earlier

Description 

Because FileMaker Pro script steps are always performed in the foreground table, it is sometimes necessary to bring a specific window to the front. Use this script step when you are working with scripts in multitable files to make certain that a script step is performed in the intended table.

Notes 

  • In FileMaker WebDirect:

    • this script step displays the specified virtual window in the web browser window. The previous virtual window remains open when it is not displayed.

    • this script step is not supported for cards.

  • In the FileMaker Data API and Custom Web Publishing, this script step makes the specified virtual window the foreground window. The previous virtual window remains open.

  • 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.

  • The Select Window script step does not open a window of a related file when the related file is opened in a hidden state, such as when a file is opened because it is the source file of a related field. To use the Select Window script step with this type of related file, open the related file using the Open File script step.

    For example, a layout in the file Data Entry contains a related field from the file Companies. When this layout is displayed, FileMaker Pro opens the Companies file in a hidden state. To open a new window displaying the hidden related file, use a script such as:

    Copy
    Open File [ Open Hidden: On ; "Companies" ]
    Select Window [ Name: "Companies" ]

    To return the file to its original state, perform a Close Window [] script step to close the open window.

  • Select Window can make visible a hidden related file if the script step is executed from within the hidden file.

Example 1 

Selects the Print Invoices window. If the Print Invoices window is not open, creates a new window and goes to the Print Invoices layout.

Copy
Select Window [ Name: "Print invoices" ]
If [ Get ( LastError ) = 112 ]
    New Window [ Style: Floating Document ; Name: "Print Invoices" ; 
    Using layout: "Print Invoices" (Invoices) ]
End If

Example 2 

Stores the UUID of a window before creating a new window, then uses the UUID to return to the original window. This ensures the correct window is selected even if multiple windows have the same name.

Copy
Set Variable [ $originalWindow ; Value: Get ( WindowUUID ) ]
New Window [ Style: Document ; Name: "Data Entry" ; Using layout: "Customers" (Customers) ]

# Perform operations in new window.

Select Window [ Name: $originalWindow ]