There are two If Window options available. One determines if the window is on top (has focus) and the other determines if the window is currently running.
Script Editor > Expand Logic Category > If Window
Select from the two If Window options described below.
If Window is Focused
Select this option to test if the selected window has focus.
If Window Running (Visible or Hidden)
Select this option to test if the selected window is currently running. The selected window may be a visible or hidden window.
Insert the name of the window to test or click on the Browse button to select from the Hidden or Visible windows currently running on the computer.
Partial Match/Exact Match
Select whether the window title must match exactly or if a partial match is sufficient.
The Exact Match requires that the window name entered matches exactly with the name of the window used in the If statement. For example, if inserting Notepad as the window name, but the window currently open when the macro runs is Notepad - Untitled, then the macro would ignore the If statement.
An exact window title match is not required. For example, insert "notepad" or "notep" as the window title and either would be recognized by the If statement. This is particularly useful as some Window Titles change based on whether a given file is open. Case sensitivity is not required. For example, "NOTepad" will work as well as "notepad".
The name contains wildcards
Select this option if including a wildcard in the window title name. A wildcard includes the " * " or " ? " characters in the title to expand the possibilities of a match. These are similar to the wildcards used in Windows for searches.