Add a file to the system clipboard

The JUCE system clipboard only allows you to add a text string, presumably it’s not a massive extension of this to allow files to be put in the clipboard, or is it? Anyone know?

1 Like


Still looking for Mac solution


    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

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

Nice… I just found that link to the reference:

Would be cool to make that available to the SystemClipBoard…


I guess it’ll need solving for iOS, Android and Linux to be an official feature?

1 Like

any news about copy / pasting from clipboard?

We solved it for Mac and Windows as above. Works well but I didn’t see anyone leaping to add it to JUCE main :wink: