NSPasteboard is the Cocoa class representation for clipboard data, allowing information to be copied and pasted within and between programs. NSPasteboards also represent information that is being dragged within or among programs.
Questions tagged [nspasteboard]
161 questions
0
votes
1 answer
Obtain clipboard's object from NSPasteboard mac
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…

hugo411
- 320
- 1
- 12
- 29
0
votes
1 answer
backgroundColor attribute lost when retrieved from NSPasteboard
When I retrieve an NSAttributedString from NSPasteboard, the background color is lost. This is what I am copying:
And this is what is returned (I am saving it to an rtf file):
This is my code for it:
func readBoard () {
var board =…

Ben A.
- 874
- 7
- 23
0
votes
1 answer
NSPasteBoard for Drag and Drop
I try to move an NSCollectionViewItem within the same NSCollectionView to allow reordering of the items. The collection view item is a custom item representing multiple labels with strings from a custom object Parameter:
class Parameter: NSObject…

JFS
- 2,992
- 3
- 37
- 48
0
votes
0 answers
How to convert to id with conforming protocol?
Why is following code failed?
NSPasteboardItem* pasteboard_item = [NSPasteboardItem new];
id temp_obj = pasteboard_item;
I am newbie in Objective-c, but as I understand, NSPasteboardItem conforms NSPasteboardWriting protocol…

Alex Aparin
- 4,393
- 5
- 25
- 51
0
votes
1 answer
NSPasteboard Copy Dragged and Dropped File
Although I have working code, I'm confused about whether I'm taking the right approach to NSPasteboard and I am reaching out to see if anyone can help me clarify the best approach.
There doesn't appear to be any full documentation written by Apple…

sketchyTech
- 5,746
- 1
- 33
- 56
0
votes
1 answer
Getting an error when trying to get text from pasteboard in macOS
I would like to get the text from the clipboard. I have write a code that seems to work but sometimes it crashes, for example when I try to use the app when I login as guest user. Maybe because the Pasterboard could not contain text.
This is the…

Cue
- 2,952
- 3
- 33
- 54
0
votes
1 answer
Swift 3 Mac OS Copy Audio File to NSPasteboard
I am trying to copy an audio file to the NSPasteboard so that it can be pasted somewhere else on the computer or into another program like Ableton or Pro Tools. Here is how I am getting the url of the file. (An example url d after casting to string…

Benjamin Porter
- 447
- 2
- 7
- 18
0
votes
1 answer
NSStringPboardType gives xml plist not the string I want
I'm trying to drag some text (a plain string) from an app.
NSString *text = @"My Text";
NSLog(@"%@", text);
I get "My Text" in the console. Then:
[pboard setPropertyList: text forType: NSStringPboardType];
If I drag this into a text editor…

Joe
- 46,419
- 33
- 155
- 245
0
votes
0 answers
NSPasteboard ops working but not DnD
I have a document-based Cocoa application with bindings enabled; it's supposed to be a text-snippet manager. I'm developing in system version 10.9 with Xcode 6.2. The main document window has a split view with a NSTableView and a NSTextView. The…

daniel julian
- 36
- 3
0
votes
2 answers
paste of nsmutableattributed string to public pasteboard loses attributes in pages
I am creating a mac standalone service that puts attributed strings on a pasteboard. When the data is accessed by pages, the string loses its attributes. I am using the following code to paste the string, with the NSReturnTypes value set to…

sakurashinken
- 3,940
- 8
- 34
- 67
0
votes
1 answer
Copy the complete content of general NSPasteboard
I need to copy the complete content of general NSPasteboard to a pasteboard with specified name. I tried this code:
- (void)copyFromGeneralPasteboard {
NSMutableArray *archive = [[NSMutableArray alloc] init];
NSArray *typeArray = [[NSPasteboard…

IamInTrouble
- 67
- 1
- 7
0
votes
1 answer
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…

Tim
- 304
- 1
- 14
0
votes
1 answer
How to get selected objects from NSArrayController without a proxy object?
I am trying to implement copying and pasting of multiple objects in an NSTableView backed by an NSArrayController. My copy: method looks like this:
- (IBAction)copy:(id)sender {
if (self.arrayController.selectionIndexes.count > 0) {
…

DanielGibbs
- 9,910
- 11
- 76
- 121
0
votes
2 answers
How can I read the clipboard using AppleScriptObjC and NSPasteboard
I'm finding my way around AppleScriptObjC and have found Shane Stanley's Everyday AppleScriptObjC helpful. But I'm still having a hard time knowing where to start with NSPasteboard.
Here's what I have so far:
use AppleScript version "2.4"
use…

tdnelson2
- 555
- 1
- 4
- 13
0
votes
2 answers
Globally replace NSPasteboard.generalPasteboard()
I want the NSPasteboard.generalPasteboard() to be temporarily switched to a custom one generated by my app using NSPasteboard.pasteboardWithUniqueName()
So that when the user presses Cmd+C/Cmd+V while the pasteboard is switched, my app's pasteboard…

Kaatt
- 1,061
- 1
- 8
- 10