How is it possible to access clipboard data on the Mac programmatically?
Asked
Active
Viewed 8,435 times
1 Answers
15
Apple has a Pasteboard Programming Guide the main class you are looking for is NSPasteboard
The example for reading strings is
NSPasteboard *pasteboard = <#Get a pasteboard#>;
NSArray *classes = [[NSArray alloc] initWithObjects:[NSString class], nil];
NSDictionary *options = [NSDictionary dictionary];
NSArray *copiedItems = [pasteboard readObjectsForClasses:classes options:options];
if (copiedItems != nil) {
// Do something with the contents...

mmmmmm
- 32,227
- 27
- 88
- 117