i need to obtain the NSPasteboard's object and store it somewhere in order to put it back to the clipboard later. I am only doing this with the text attribute right now. I want to know how to do this with any object (example : copy a file). Here is my code so far for getting the text and putting it back :
NSString *pasteboardString;
//Save the value of the pasteboard
NSPasteboard *pasteboard= [NSPasteboard generalPasteboard];
pasteboardString= [pasteboard stringForType:NSStringPboardType];
//Clear the pasteboard
[pasteboard clearContents];
//Do some stuff with clipboard
//Write the old object back
if(pasteboardString!= NULL || pasteboardString.length != 0){
[pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
[pasteboard setString:pasteboardString forType:NSStringPboardType];
}