# GroupClose

Closes the active window if it was just activated by GroupActivate or GroupDeactivate. It then activates the next window in the series. It can also close all windows in a group.

    GroupClose, GroupName , Mode

## Parameters

GroupName

  The name of the group as originally defined by GroupAdd.

Mode

  If omitted, the command closes the active window and activates the oldest window in the series. To change this behavior, specify one of the following letters:

  R: The newest window (the one most recently active) is activated, but only if no members of the group are active when the command is given. "R" is useful in cases where you temporarily switch to working on an unrelated task. When you return to the group via GroupActivate, GroupDeactivate, or GroupClose, the window you were most recently working with is activated rather than the oldest window.

  A: All members of the group will be closed. This is the same effect as `WinClose ahk_group GroupName`.

## Remarks

When the Mode parameter is not "A", the behavior of this command is determined by whether the previous action on GroupName was GroupActivate or GroupDeactivate. If it was GroupDeactivate, this command will close the active window only if it is not a member of the group (otherwise it will do nothing). If it was GroupActivate or nothing, this command will close the active window only if it is a member of the group (otherwise it will do nothing). This behavior allows GroupClose to be assigned to a hotkey as a companion to GroupName's GroupActivate or GroupDeactivate hotkey.

See GroupAdd for more details about window groups.

## Related

GroupAdd, GroupActivate, GroupDeactivate

## Examples

#1

    GroupClose, MyGroup, R