Mac Developer Library

Developer

AppKit Framework Reference NSWindowScripting Protocol Reference

Options
Deployment Target:

On This Page
Language:

NSWindowScripting

Inheritance


Not Applicable

Conforms To


Not Applicable

Import Statement


Swift

import AppKit

Objective-C

@import AppKit;

Availability


Available in OS X v10.0 and later.

Category on NSWindow. Supports window scripting for all scriptable Cocoa applications by getting and setting standard properties and handling the close, print, and save AppleScript commands.

  • Returns YEStrue if the receiver has a close box.

    Declaration

    Swift

    var hasCloseBox: Bool { get }

    Objective-C

    @property(readonly) BOOL hasCloseBox

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns YEStrue if the receiver has a title bar.

    Declaration

    Swift

    var hasTitleBar: Bool { get }

    Objective-C

    @property(readonly) BOOL hasTitleBar

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • isFloatingPanel - isFloatingPanel Available in OS X v10.0 through OS X v10.9

    Returns YEStrue if the receiver is a floating panel.

    Declaration

    Objective-C

    - (BOOL)isFloatingPanel

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • isMiniaturizable - isMiniaturizable Available in OS X v10.0 through OS X v10.9

    Returns YEStrue if the receiver can be miniaturized (has a minimize button).

    Declaration

    Objective-C

    - (BOOL)isMiniaturizable

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • isModalPanel - isModalPanel Available in OS X v10.0 through OS X v10.9

    Returns YEStrue if the receiver is an application-modal panel.

    Declaration

    Objective-C

    - (BOOL)isModalPanel

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • isResizable - isResizable Available in OS X v10.0 through OS X v10.9

    Returns YEStrue if the receiver is resizable (has a size control).

    Declaration

    Objective-C

    - (BOOL)isResizable

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

  • isZoomable - isZoomable Available in OS X v10.0 through OS X v10.9

    Returns YEStrue if the receiver is zoomable (has a zoom button).

    Declaration

    Objective-C

    - (BOOL)isZoomable

    Import Statement

    Objective-C

    @import AppKit;

    Availability

    Available in OS X v10.0 through OS X v10.9.

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

    Declaration

    Swift

    func setIsMiniaturized(_ flag: Bool)

    Objective-C

    - (void)setIsMiniaturized:(BOOL)flag

    Discussion

    Depending on the current miniaturized state and the value of flag, the window may be minimized to the Dock or expanded from the Dock.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func setIsVisible(_ flag: Bool)

    Objective-C

    - (void)setIsVisible:(BOOL)flag

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func setIsZoomed(_ flag: Bool)

    Objective-C

    - (void)setIsZoomed:(BOOL)flag

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func handleCloseScriptCommand(_ command: NSCloseCommand) -> AnyObject?

    Objective-C

    - (id)handleCloseScriptCommand:(NSCloseCommand *)command

    Discussion

    Extracts close command arguments from the command object and uses them to determine how to close the associated document—specifically, whether to ignore unsaved changes, save changes automatically, or ask the user and to identify the file in which to save the document (by default, the file that was opened or previously saved to, or an “untitled” name if the file has never been saved).

    If there is a corresponding document and the window is the main window of the document, it forwards the close command to the corresponding document; otherwise, the window sends itself a performClose message, if it has a close box. This may have been handled differently in versions of OS X prior to version 10.3.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func handlePrintScriptCommand(_ command: NSScriptCommand) -> AnyObject?

    Objective-C

    - (id)handlePrintScriptCommand:(NSScriptCommand *)command

    Discussion

    If there is a corresponding document and the window is the main window of the document, it forwards the print command to the corresponding document; otherwise, the window sends itself a print message. This may have been handled differently in versions of OS X prior to version 10.3.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

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

    Declaration

    Swift

    func handleSaveScriptCommand(_ command: NSScriptCommand) -> AnyObject?

    Objective-C

    - (id)handleSaveScriptCommand:(NSScriptCommand *)command

    Discussion

    The default version invokes the same named method of the window's document, if the window is the one being saved.

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • Returns the zero-based position of the receiver based on its order from front to back among all application windows.

    Declaration

    Swift

    var orderedIndex: Int

    Objective-C

    @property NSInteger orderedIndex

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.

  • 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.

    Declaration

    Swift

    var orderedIndex: Int

    Objective-C

    @property NSInteger orderedIndex

    Import Statement

    Objective-C

    @import AppKit;

    Swift

    import AppKit

    Availability

    Available in OS X v10.0 and later.