Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement writeObjects for Pasteboard #22

Open
jdmremi opened this issue Dec 28, 2021 · 2 comments
Open

Implement writeObjects for Pasteboard #22

jdmremi opened this issue Dec 28, 2021 · 2 comments

Comments

@jdmremi
Copy link

jdmremi commented Dec 28, 2021

Referencing this Stack Overflow article, the following code allows the user to copy some object (in this case, a file) to the clipboard:

NSURL *object = [[NSURL alloc] initFileURLWithPath:@"/Users/username/Desktop/main.png"];
NSPasteboard *pb = [NSPasteboard generalPasteboard];
[pb clearContents];

NSArray *objectsToCopy = [[NSArray alloc] initWithObjects:object, nil];
BOOL pasted = [pb writeObjects:objectsToCopy];

if(pasted) // paste was successful
    NSLog(@"pasted");

[object release];
[objectsToCopy release];
[pb release];

However, after reading through the documentation/the Pasteboard implementation, it does not appear that there is a straightforward way to do this by using Cacao, as there is only support for writing text to the Pasteboard (clipboard).

@ryanmcgrath
Copy link
Owner

This should actually be easier in the 0.3 branch, which I need to land. Will revisit it then - hopefully within the next week or two.

@jdmremi
Copy link
Author

jdmremi commented Mar 16, 2022

Hey! Any update on this request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants