Next Page > Hide TOC

NSWindowScripting Protocol Reference

(informal protocol)

Framework
/System/Library/Frameworks/AppKit.framework
Companion guide
Declared in
NSWindowScripting.h

Overview

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.

Tasks

Getting Scripting Attribute Information About a Window

Setting Scripting Attribute Information for a Window

Handling Script Commands

Working with Ordered Indices

Instance Methods

handleCloseScriptCommand:

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

- (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 Mac OS X prior to version 10.3.

Availability
Declared In
NSWindowScripting.h

handlePrintScriptCommand:

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

- (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 Mac OS X prior to version 10.3.

Availability
Declared In
NSWindowScripting.h

handleSaveScriptCommand:

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

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

Availability
Declared In
NSWindowScripting.h

hasCloseBox

Returns YES if the receiver has a close box.

- (BOOL)hasCloseBox

Availability
Declared In
NSWindowScripting.h

hasTitleBar

Returns YES if the receiver has a title bar.

- (BOOL)hasTitleBar

Availability
Declared In
NSWindowScripting.h

isFloatingPanel

Returns YES if the receiver is a floating panel.

- (BOOL)isFloatingPanel

Availability
Declared In
NSWindowScripting.h

isMiniaturizable

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

- (BOOL)isMiniaturizable

Availability
Declared In
NSWindowScripting.h

isModalPanel

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

- (BOOL)isModalPanel

Availability
Declared In
NSWindowScripting.h

isResizable

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

- (BOOL)isResizable

Availability
Declared In
NSWindowScripting.h

isZoomable

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

- (BOOL)isZoomable

Availability
Declared In
NSWindowScripting.h

orderedIndex

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

- (int)orderedIndex

Availability
Declared In
NSWindowScripting.h

setIsMiniaturized:

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

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

Availability
Declared In
NSWindowScripting.h

setIsVisible:

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

- (void)setIsVisible:(BOOL)flag

Availability
Declared In
NSWindowScripting.h

setIsZoomed:

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

- (void)setIsZoomed:(BOOL)flag

Availability
Declared In
NSWindowScripting.h

setOrderedIndex:

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.

- (void)setOrderedIndex:(int)index

Availability
Declared In
NSWindowScripting.h

Next Page > Hide TOC


© 2006 Apple Computer, Inc. All Rights Reserved. (Last updated: 2006-05-23)


Did this document help you?
Yes: Tell us what works for you.
It’s good, but: Report typos, inaccuracies, and so forth.
It wasn’t helpful: Tell us what would have helped.