Win Close
Win Close
Section titled “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).
How it works
Section titled “How it works”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
sessionand you are inside a Win Attachbody, 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.
Required parameters
Section titled “Required parameters”None.
Optional parameters
Section titled “Optional parameters”| Parameter | Type | Default | Description |
|---|---|---|---|
session | ZoanDesktopSession | — | The session returned by Win Attach. Empty = the session of the body the activity is in. |
Output
Section titled “Output”This activity does not return a value.
Common errors
Section titled “Common errors”| Message | Cause 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. |
Example
Section titled “Example”Win Attach selector = (window "Notepad") → output: appWin Type session = app selector = (text area) text = "Hello"Win Close session = appIf the application asks whether to save, answer the dialog after closing:
Win Close session = appWin Attach selector = (window "Notepad") // the window is still open with its dialog └─ body: Win Click selector = (button "Don't save")Related activities
Section titled “Related activities”- Win Attach — open the session you close here.
- Kill Process — terminate the application’s process.
- Try / Catch — close in
finally.