Pasteboard Class Reference

 

Overview

The Pasteboard class defines methods that allow you to query the services pasteboard for its content, as well as put data back onto it. You can also target the Clipboard by its symbolic name (NSGeneralPboard) if you wish to read and write data to and from the clipboard.

 

Pasteboard Data Types

The following global variables are automatically available to your F-Script and are used to identify the various types of pasteboard data. You can use these symbolic names instead of creating new strings. For more information on the meaning of these types, see the Apple developer documentation for the NSPasteboard class.

Additionally, you can target the general clipboard by name using the NSGeneralPboard constant.

 

Pasteboard Class Method List

The following methods are available in the Pasteboard class:

 

Pasteboard Class Method Descriptions

+ (NSArray *)typesForPasteboard:(NSString *)aPasteboard
Returns an array of pasteboard types that are available on the services pasteboard identified by aPasteboard. The returned array will consist of strings from the list of global pasteboard type constants described earlier in the document.

 

+ (void)declareTypes:(NSArray *)aTypeList forPasteboard:(NSString *)aPasteboard
Configures aPasteboard so that it can hold the pasteboard types in the array aTypeList, which should be an NSArray of strings representing a subset of the pasteboard types defined in the global pasteboard type constants appearing earlier in this document.

 

+ (NSData *)readDataOfType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Queries the services pasteboard aPasteboard for data of the given pasteboard type aType, and returns it as an NSData object. aType should be one of the pasteboard data types.

 

+ (void)writeData:(NSData *)aData ofType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Writes aData, which should be an NSData object, to aPasteboard with the pasteboard data type aType. Before calling this method, be sure to call the +declareTypes:... method to configure the pasteboard for the proper types.

 

+ (NSString *)readStringOfType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Queries aPasteboard for data of the given pasteboard type aType, and returns it as a string.

 

+ (void)writeString:(NSString *)aString ofType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Writes aString, which should be a string, to aPasteboard with the pasteboard data type aType. Before calling this function, be sure to call +declareTypes:... to configure the pasteboard for the proper types.

 

+ (NSArray *)readArrayOfType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Queries aPasteboard for an array of objects of the given pasteboard data type aType. Returns the contents as an NSArray object.

 

+ (void)writeArray:(NSArray *)anArray ofType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Writes anArray, which should be an NSArray object, to aPasteboard with the pasteboard data type aType. Before calling this function, be sure to call +declareTypes:... to configure the pasteboard for the proper types.

 

+ (NSDictionary *)readDictionaryOfType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Queries aPasteboard for a dictionary of the given pasteboard data type aType. Returns the contents as an NSDictionary object.

 

+ (void)writeDictionary:(NSDictionary *)aDictionary ofType:(NSString *)aType forPasteboard:(NSString *)aPasteboard
Writes aDictionary, which should be an NSDictionary object, to aPasteboard with the pasteboard data type aType. Before calling this function, be sure to call +declareTypes:... to configure the pasteboard for the proper types.