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

win32clipboard #2371

Open
leno166 opened this issue Sep 14, 2024 · 1 comment
Open

win32clipboard #2371

leno166 opened this issue Sep 14, 2024 · 1 comment

Comments

@leno166
Copy link

leno166 commented Sep 14, 2024

def setter(self, paths):
    files = ("\0".join(paths)).replace("/", "\\")
    data = files.encode("U16")[2:] + b"\0\0"

    win32clipboard.OpenClipboard()

    win32clipboard.EmptyClipboard()
    win32clipboard.SetClipboardData(win32clipboard.CF_HDROP, self.matedata + data)

    win32clipboard.CloseClipboard()

this is my codes. i use some path to test. sometime it could work. sometime, the path had in Clipboard, but cant ctrl+v to copy.

def read_paths(self):
    win32clipboard.OpenClipboard()
    try:
        return win32clipboard.GetClipboardData(win32clipboard.CF_HDROP)
    finally:
        win32clipboard.CloseClipboard()

this is read. i use this to debug.

i_path = r'D:\workflow\2403_pythonProject\18_XYsolution\cache\PrtSc111.png' this couldn't be copy
i_path = r'D:\workflow\2403_pythonProject\12_PrtSc\cache\img.png' this could.

its so confused

@leno166
Copy link
Author

leno166 commented Sep 14, 2024

and i copy use method ctrl+c. than i use the code. it could be work in right

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

1 participant