nspasteboard

How do I handle multiple file drag/drop from Finder in Mac OS X 10.5?

I need to get the URLs of all files dragged/dropped into my application from Finder. I have a Cocoa app running on 10.6 which does this by using the new 10.6 NSPasteboard APIs which handle multiple items on the pasteboard. I'm trying to backport this app to 10.5. How do I handle this on 10.5? If I do something like below, I only get ...

Override paste: to format text

Hello, I would like to capture a string being pasted into a control and apply some custom formatting to the string before being pasted. How is this possible? Thanks! ...

Cocoa Virtual Keystrokes Pain

I'm writing an application to respond on a hotkey by copying highlighted text into NSPasteboard's generalPasteboard. After looking around here for a solution for sending virtual keystrokes, I found this: http://stackoverflow.com/questions/1505933/how-to-send-a-cmd-c-keystroke-to-the-active-application-in-objective-c-or-tell I tried the ...

How to paste text from one app to another using Cocoa?

I have read about NSPasteBoard in the Apple documentation, and how it allows for applications to write into the PasteBoard and allow other applications to read that text and use it. Could someone tell me how to paste text from am application (that sits in the status bar) into a NSTextField that is inside a different application. What ...

Crashing the OS X Pasteboard

I have an application that reads in text by emulating CMD-C copy commands and reading the pasteboard - unfortunately this the only way to achieve what I need. Occasionally, as this is under development, once in a while I do something wrong (I don't think it's related to the copy command) and the app crashes. Once in a while, this has a...

How can I check that the NSPasteboard is updated?

I'm automating a copy command to place some text on the pasteboard every second or so - unfortunately this is my only way of accessing the text, which is in another application. After copying, I access the pasteboard text and process it. Sometimes, the copy command will be sent when nothing is selected - for example in textEdit, if the...

how can i copy the text in the textfield cell (in cocoa) to NSPasteboard?

hi, I have a textfield cell and a push button in the cocoa . I want to copy the text in teh textfield by clicking on the button. in clipboard.h #import <Cocoa/Cocoa.h> @interface clipboard:NSObject { IBOutlet id but1; IBOutlet id numf2_1; NSPasteboard *pasteBoard; } - (BOOL) writeToPasteBoard:(NSString *)stringToWrite; ...

Get NSTableView to register drop from PNG source

Trying to get this to work, and not sure what I'm missing. The idea is to drop images on a NSTableView so that I can grab their paths and do some manipulations for them. I can get the drop to work for NSPastebouardTypeString, but I cannot for the life of me get it to register dragging PNGs from Finder into the tableview. What am I missin...

NSPasteboard setString:forType: returns NO under Leopard, fine in Snow Leopard

The following code is from a NSTableViewDataSource where I'm trying to impliement drag and drop. Can someone tell me why the setString:forTypes: method in the following code returns NO under Leopard? It works fine in Snow Leopard. I checked the "Pasteboard Programming Topics for Cocoa" legacy document but I can't figure out what I'm doi...

Dragging pasteboard is nil when remote debugging from Xcode

I'm writing an app that needs to work in both 10.5 and 10.6 (We still have PPC machines). My development machine is 10.6.4 with Xcode 3.2.3, and I have a 10.5.8 machine with Xcode 3.1.2 on it. I use remote debugging to test out the app on the 10.5.8 machine, and I've run into a problem with a Drag and Drop method that only occurs when r...

Why is -[NSPasteboard writeObjects:] returning NO for an array of NSURL objects?

I have an NSArrayController that I'm using to provide data to an IKImageBrowserView. I want to support drag and drop from the IKImageBrowserView to other applications. Here's the relevant method from my code: - (NSUInteger) imageBrowser:(IKImageBrowserView *) aBrowser writeItemsAtIndexes:(NSIndexSet *) itemIndexes toPasteboard:(NSPasteb...