NSWindowScripting

A set of methods that supports window scripting for all scriptable Cocoa apps.

Topics

Getting Information About Scripting Attributes

var hasCloseBox: Bool

Returns true if the receiver has a close box.

var hasTitleBar: Bool

Returns true if the receiver has a title bar.

Setting Scripting Attributes

func setIsMiniaturized(Bool)

Sets the receiver’s miniaturized state to the value specified by flag.

func setIsVisible(Bool)

Sets the receiver’s visible state to the value specified by flag.

func setIsZoomed(Bool)

Sets the receiver’s zoomed state to the value specified by flag.

Handling Script Commands

func handleClose(NSCloseCommand)

Handles the close AppleScript command by attempting to close the window (and its associated document, if any).

func handlePrint(NSScriptCommand)

Handles the print AppleScript command by attempting to print the contents of the window (or its associated document, if any).

func handleSave(NSScriptCommand)

Handles the save AppleScript command by attempting to save the window (and its associated document, if any).

Working with Ordered Indices

var orderedIndex: Int

Sets the zero-based position of the receiver, based on its order from front to back among all visible application windows, to the value specified by index. If index is out of range, sets the position to the nearest value that is in range.

See Also

Windows

class NSWindow

A window that an app displays on the screen.

class NSPanel

A special kind of window that typically performs a function that is auxiliary to the main window.

protocol NSWindowDelegate

A set of optional methods that a delegate of NSWindow can implement to respond to events, such as window resizing, moving, exposing, and minimizing.

Tabbed Windows

Support tabbed windows in your app.

NSLayerDelegateContentsScaleUpdating

A protocol that defines an optional CALayer delegate method for handling resolution changes.