I want to make a copy-paste application. How do I develop an Objective-C program where I can copy the data from the file a user has clicked on Finder? For example, normal copy-pasting can copy any file a user clicks on the Finder, how can my program do the same?
I also would like to know how to copy ANY text from other apps (i.e. text editor), just like normal copy-pasting?
I’ll clarify more if needed. Thanks.
Start by reading the Pasteboard Programming Guide. When you copy data in any program, that data is typically stored on a pasteboard. The program where the copying took place can choose to export the data on its pasteboards, or not. If it does, it can also choose to translate the data into other formats that might be more useful to other programs.
You can’t, and shouldn’t, worry about trying to copy data in other programs. Those other programs will do that for you. All your program has to do is to look at the data on the available pasteboards and use those items that are appropriate for whatever you’re doing. So, if a user copies (or cuts) some text in a text editor and then switches to your app, the data will generally be waiting for you on one of the pasteboards.