String to Clipboard
Quote from Forum Archives on July 6, 2010, 7:39 pmPosted by: kshmidheiser <kshmidheiser@...>
Here's a little snippet that copies a string to the Clipboard.Ken
BeginCCode
void StringToClipboard( CFStringRef stringToPaste ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[NSPasteboard generalPasteboard] declareTypes:[NSArray
arrayWithObject: NSStringPboardType] owner:nil];
[[NSPasteboard generalPasteboard] setString:(NSString *)stringToPaste
forType: NSStringPboardType];
[pool drain];
}
EndC
toolbox fn StringToClipboard( CFStringRef stringToPaste ) = intfn StringToClipboard( @"This is a test string to copy to Clipboard" )
RunApplicationEventLoop()
Posted by: kshmidheiser <kshmidheiser@...>
Ken
BeginCCode
void StringToClipboard( CFStringRef stringToPaste ) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
[[NSPasteboard generalPasteboard] declareTypes:[NSArray
arrayWithObject: NSStringPboardType] owner:nil];
[[NSPasteboard generalPasteboard] setString:(NSString *)stringToPaste
forType: NSStringPboardType];
[pool drain];
}
EndC
toolbox fn StringToClipboard( CFStringRef stringToPaste ) = int
fn StringToClipboard( @"This is a test string to copy to Clipboard" )
RunApplicationEventLoop()