Created
July 6, 2020 16:28
-
-
Save udf/23a992d006b4c8f2984a769f1338804c to your computer and use it in GitHub Desktop.
Revisions
-
udf created this gist
Jul 6, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,39 @@ import win32clipboard as clipboard class ClipboardWrapper: def __init__(self): pass def __enter__(self): clipboard.OpenClipboard() def __exit__(self, type, value, traceback): clipboard.CloseClipboard() formats = [] with ClipboardWrapper(): format = clipboard.EnumClipboardFormats(0) formats.append(format) while 1: format = clipboard.EnumClipboardFormats(formats[-1]) if format == 0: break formats.append(format) format_names = {} for format in formats: name = '' try: name = clipboard.GetClipboardFormatName(format) except: pass try: data = clipboard.GetClipboardData(format) except: pass format_names[format] = name print(format_names) breakpoint() print()