Skip to content

Win Close

Type: win-close  ·  Package: Desktop Activities v1.0.8

Closes a window and releases the session. It is the activity you finish with when you used Win Attach without body (Option B of the session model).

It asks the session’s window to close (like pressing its X button) and releases the resources. After that, the session can no longer be used.

  • If you don’t set session and you are inside a Win Attach body, it closes that Win Attach’s window.
  • The close request is orderly: if the application shows a dialog (“Save changes?”), the window stays open until someone answers it. If the window cannot be closed, the activity does not fail: it releases the session anyway.
  • It does not terminate the process: that’s what Kill Process is for.

None.

ParameterTypeDefaultDescription
sessionZoanDesktopSession—The session returned by Win Attach. Empty = the session of the body the activity is in.

This activity does not return a value.

MessageCause and fix
'session' is required and must be a desktop session.No session was passed and the activity is not inside a Win Attach. Pass the output of Win Attach in session.
Win Attach selector = (window "Notepad") → output: app
Win Type session = app selector = (text area) text = "Hello"
Win Close session = app

If the application asks whether to save, answer the dialog after closing:

Win Close session = app
Win Attach selector = (window "Notepad") // the window is still open with its dialog
└─ body:
Win Click selector = (button "Don't save")