Home > Language Reference > Windows Management Functions > CloseWindowRegEx


The CloseWindowRegEx function closes the specified window, using Regular Expressions to specify the window name (its title part).


Used to close the child window from parent window, when child window name changes from one execution to another.


ret=CloseWindowRegEx(<window_name> [,forced])


<window_name>, string, window name of the window to close. You can use a Regular Expression to specify the part title of <window_name>. See Using Regular Expressions.

forced, optional keyword. If forced is used (default value), the window is forced to close after 30 seconds even if a dialog box prompts for an answer. 

Return value

ret, optional numeric return value. If the window has been successfully closed within 30 seconds (this default value can be changed using #ActionTimeout), the function returns 0. If the function fails, the return value is a nonzero value (see Window Functions Error Codes).

See also



'Single character
'Closes the notepad window whatever character is after Doc
'Triggers for any window Doca, Docb, ..., Doc0, Doc1, ....

'Single character in a list
'Closes the notepad window if, after Doc, the year is 2005, 2006 or 2007
'Triggers for any window Doc2005, Doc2006, or Doc2007

'Single character NOT in a list
'Closes the notepad window if, after Doc, the year is NOT 2005, 2006 or 2007
'Triggers for any window Doc2000, Doc2001, Doc2002, Doc2003, Doc2004, Doc2008, Doc2009 and Doc200a, Doc200b, ...

'Single character within a range
'Closes the notepad window if, after Doc, it can be any year in the 1990s
'Triggers for any window Doc1990, Doc1991,..., Doc1999