Skip to content
This repository has been archived by the owner on Jun 9, 2023. It is now read-only.

Latest commit

 

History

History
185 lines (156 loc) · 15.1 KB

cp.ui.Window.md

File metadata and controls

185 lines (156 loc) · 15.1 KB

docs » cp.ui.Window


A Window UI element.

API Overview

API Documentation

Functions

Signature cp.ui.Window.findSectionUI(windowUI, sectionID) -> hs._asm.axuielement
Type Function
Description Finds the axuielement for the specified sectionID, if present in the provided axuielement windowUI.
Parameters
  • windowUI - The AXWindow axuielement to search in.
  • sectionID - The string value for the SectionUniqueID.
Returns
  • The matching axuielement, or nil.
Signature cp.ui.Window.matches(element) -> boolean
Type Function
Description Checks if the provided element is a valid window.

Constructors

Signature cp.ui.Window(cpApp, uiProp) -> Window
Type Constructor
Description Creates a new Window
Parameters
  • cpApp - a cp.app for the application the Window belongs to.
  • uiProp - a cp.prop that returns the hs._asm.axuielement for the window.
Returns
  • A new Window instance.

Fields

Signature cp.ui.Window.alert <cp.ui.Alert>
Type Field
Description Provides access to any 'Alert' windows on the Window.
Signature cp.ui.Window.exists <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window exists. It may not be visible.
Signature cp.ui.Window.focused <cp.prop: boolean>
Type Field
Description Is true if the window has mouse/keyboard focused.
Signature cp.ui.Window.frame <cp.prop: hs.geometry rect>
Type Field
Description The hs.geometry rect value describing the window's position.
Signature cp.ui.Window.hsWindow <cp.prop: hs.window; read-only>
Type Field
Description The hs.window instance for the window, or nil if it can't be found.
Signature cp.ui.Window.id <cp.prop: string; read-only>
Type Field
Description The window title, or nil if the window is not currently visible.
Signature cp.ui.Window.isFullScreen <cp.prop: boolean>
Type Field
Description Returns true if the window is full-screen.
Signature cp.ui.Window.isShowing <cp.prop: boolean; read-only; live?>
Type Field
Description Indicates if the Window is currently showing on screen.
Signature cp.ui.Window.minimized <cp.prop: boolean>
Type Field
Description Returns true if the window exists and is minimised.
Signature cp.ui.Window.UI <cp.prop: hs._asm.axuielement: read-only; live?>
Type Field
Description The UI axuielement for the Window.
Signature cp.ui.Window.visible <cp.prop: boolean; read-only>
Type Field
Description Returns true if the window is visible on a screen.

Methods

Signature cp.ui.Window:close() -> boolean
Type Method
Description Attempts to close the window.
Parameters
  • None
Returns
  • true if the window was successfully closed.
Signature cp.ui.Window:doClose() -> cp.rx.go.Statement <boolean>
Type Method
Description Returns a Statement that will attempt to close the window, if it is visible.
Parameters
  • None
Returns
  • The Statement to execute, resolving to true if the window is closed successfully, or false if not.
Signature cp.ui.Window:doFocus() -> cp.rx.go.Statement
Type Method
Description Returns a Statement will attempt to focus on the window, if it is visible.
Parameters
  • None
Returns
  • The Statement to execute, which resolves to true if the window was successfully focused, or false if not.
Signature cp.ui.Window:findSectionUI(sectionID) -> hs._asm.axuielement
Type Method
Description Looks for th section with the specified SectionUniqueID value and returns the matching axuielement value.
Parameters
  • sectionID - The string for the section ID.
Returns
  • The matching axuielement, or nil.
Signature cp.ui.Window:focus() -> boolean
Type Method
Description Attempts to focus the window.
Parameters
  • None
Returns
  • true if the window was successfully focused.
Signature cp.ui.Window:notifier() -> cp.ui.notifier
Type Method
Description Returns a notifier that is tracking the application UI element. It has already been started.
Parameters
  • None
Returns
  • The notifier.

| Signature | cp.ui.Window:snapshot([path]) -> hs.image | nil | | -----------------------------------------------------|---------------------------------------------------------------------------------------------------------| | Type | Method | | Description | Takes a snapshot of the UI in its current state as a PNG and returns it. | | Parameters |

  • path - (optional) The path to save the file. Should include the extension (should be .png).
|