This is a small library for windows OS to work with clipboard data storage. winclip32 is based on pywin32 module.
https://github.com/PyPcDeV/winclip32
Installation
Only Windows OS
pip install winclip32
Code Examples
Example 1
import winclip32
winclip32.set_clipboard_data("unicode_std_text", "Python is beautiful!!!")
print(winclip32.get_clipboard_data("unicode_std_text")) # >>> Python is beautiful!!!
Example 2
import winclip32
winclip32.set_clipboard_data("unicode_std_text", "Python is beautiful!!!")
print(winclip32.is_clipboard_data_type_available("bitmapinfo_std_structure")) # >>> False
print(winclip32.is_clipboard_data_type_available(13)) # >>> True
Example 3
import winclip32
winclip32.get_clipboard_data_types_info() # >>> ...
API
winclip32.get_clipboard_formats_info() >> print all informations about winclip32 clipboard formats
winclip32.get_clipboard_data(format) >> format: str / int; return data or error if something went wrong
winclip32.set_clipboard_data(format, data) >> format: str / int; data: int/str/unicode/any object that supports the buffer interface; return data or error if something went wrong
winclip32.is_clipboard_format_available(format) >> format: str / int; return True if format is available, False if not, and error if something went wrong
winclip32.count_clipboard_formats() >> return the number of different formats currently on the clipboard.
winclip32.empty_clipboard() >> empty the clipboard
winclip32.Recorder(format=13, mark=None) >> format: str / int; mark: str; create a recorder for clipboard changes
winclip32.Recorder().record(record_interval=0.1) >> record_interval: int; record the clipboard changes and add them to the recording list or dict
winclip32.Recorder().get_recording() >> return the recorded list or dict
winclip32.Recorder().clear_recorder() >> clear the recording list or dict. use this for new records
winclip32.Recorder().set_format(format) >> format: str / int; set the main record format
winclip32.Recorder().set_mark(mark) >> mark: str; set the main record mark
Constants
- winclip32.ANSI_STD_TEXT
- winclip32.ANSI_MSL_TEXT
- winclip32.ANCII_DIF_TEXT
- winclip32.BIT8_DOS_TEXT
- winclip32.UNICODE_STD_TEXT
- winclip32.ANSI_DSP_TEXT
- winclip32.HBITMAP_GDI_STD_OBJECT
- winclip32.HBITMAP_GDI_DSP_OBJECT
- winclip32.BITMAPINFO_STD_STRUCTURE
- winclip32.METAFILEPICT_STD_STRUCTURE
- winclip32.METAFILEPICT_DSP_STRUCTURE
- winclip32.TIFF_STD_IMAGE
- winclip32.HPALETTE_GDI_STD_OBJECT
- winclip32.PENDATA_STD_DATA
- winclip32.RIFF_STD_AUDIO
- winclip32.WAVE_STD_AUDIO
- winclip32.HENHMETAFILE_STD_HANDLE
- winclip32.HENHMETAFILE_DSP_HANDLE
- winclip32.DROPFILES_STD_LIST
- winclip32.DWORD_STD_LCID
- winclip32.BITMAPV5HEADER_STD_STRUCTURE
- winclip32.NUMERIC_MARK
- winclip32.STIME_MARK
- winclip32.DTTIME_MARK
Update v0.6.0 --Recorder update--
Stable version of 0.6.0a
Update v0.6.0a --Recorder update--
Update v0.5.4
-
Renamed
- winclip32.get_clipboad_data_types_info() to winclip32.get_clipboard_formats_info()
- winclip32.get_clipboard_data(type_key) to winclip32.get_clipboard_data(format)
- winclip32.set_clipboard_data(type_key, data) to winclip32.set_clipboard_data(format, data)
- winclip32.is_clipboard_data_type_available(type_key) to winclip32.is_clipboard_format_available(format)
- winclip32.count_clipboard_data_types() to winclip32.count_clipboard_formats()
-
Added format constants
- winclip32.ANSI_STD_TEXT
- winclip32.ANSI_MSL_TEXT
- winclip32.ANCII_DIF_TEXT
- winclip32.BIT8_DOS_TEXT
- winclip32.UNICODE_STD_TEXT
- winclip32.ANSI_DSP_TEXT
- winclip32.HBITMAP_GDI_STD_OBJECT
- winclip32.HBITMAP_GDI_DSP_OBJECT
- winclip32.BITMAPINFO_STD_STRUCTURE
- winclip32.METAFILEPICT_STD_STRUCTURE
- winclip32.METAFILEPICT_DSP_STRUCTURE
- winclip32.TIFF_STD_IMAGE
- winclip32.HPALETTE_GDI_STD_OBJECT
- winclip32.PENDATA_STD_DATA
- winclip32.RIFF_STD_AUDIO
- winclip32.WAVE_STD_AUDIO
- winclip32.HENHMETAFILE_STD_HANDLE
- winclip32.HENHMETAFILE_DSP_HANDLE
- winclip32.DROPFILES_STD_LIST
- winclip32.DWORD_STD_LCID
- winclip32.BITMAPV5HEADER_STD_STRUCTURE
-
Renamed errors. Current:
- winclip32.invalid_clipboard_format_given(f)
- winclip32.unknown_clipboard_format_given(f)
- winclip32.clipboard_format_is_not_available(f)
- winclip32.something_went_wrong
- winclip32.invalid_clipboard_format_or_data_given