b-init / ImagePaste

A simple Blender addon to grab images from your clipboard and paste as a reference image in viewport or onto the image editor.
GNU General Public License v3.0
246 stars 9 forks source link

FEATURE: Copy export multiple image file to clipboard? #27

Open atticus-lv opened 2 years ago

atticus-lv commented 2 years ago

Problem

I am working on export multiple files to clipboard. So that I can paste them to finder easily But I am not very familiar with mac, so I only create a simple script to export only one file

class MacClipboard():
    def __init__(self, file_urls=None):
        # file_urls: list[str] = None
        self.file_urls = file_urls
    def push_to_clipboard(self, paths):
        commands = [
            "set the clipboard to "
            f'(POSIX file "{paths[0]}")'
        ]
        subprocess.Popen(self.get_osascript_args(commands))

    def get_osascript_args(self, commands):
        args = ["osascript"]
        for command in commands:
            args += ["-e", command]
        return args

Idea

Now I want to copy multiple files to clipboard on mac, but I don't know how to let it to be run in subprocess. I found some script like this

Images

No response

Additional context

No response

thanhph111 commented 2 years ago

Bad news, I'm not familiar with macOS too, neither AppleScript :rofl:. But with non-Blender procedures like this, I can use a virtual machine to test.

As I understand, you are trying to stack multiple images to the clipboard so we can paste them to other apps (like Finder). That's great, but what editor would you like to implement the operator for?

I also want to replace totally the current pasteboard binary by AppleScript, but I still don't have a chance to work with macOS. If you want to implement this feature, I would love to help.

The terminology push and pull may confuse you at first, I think the comment here and here would help.

You also might find useful information about macOS implementation history in this and this PR.

atticus-lv commented 2 years ago

FIne, I don't have a chance to work with macOS, too. I just make an extra part base on this addon for my friend who work on mac(I finish the win part actually, it is much easier for me to test). However, testing mac (remote working on his computer) is really hard.

thanhph111 commented 2 years ago

@williamchange Sorry to ping you on any macOS and Apple related posts but I'd really like to hear your opinion on this. Do you think the macOS clipboard can hold multiple images at once with AppleScript?