Python win32clipboard.SetClipboardText() Examples
The following are 10
code examples of win32clipboard.SetClipboardText().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32clipboard
, or try the search function
.
Example #1
Source File: clipboard.py From code with MIT License | 7 votes |
def put(data): if sys.platform == "win32": import win32clipboard as clip clip.OpenClipboard() clip.EmptyClipboard() clip.SetClipboardText(data, clip.CF_UNICODETEXT) clip.CloseClipboard() elif sys.platform.startswith("linux"): import subprocess proc = subprocess.Popen(("xsel", "-i", "-b", "-l", "/dev/null"), stdin=subprocess.PIPE) proc.stdin.write(data.encode("utf-8")) proc.stdin.close() proc.wait() else: raise RuntimeError("Unsupported platform")
Example #2
Source File: profiling_tools.py From pyxll-examples with The Unlicense | 6 votes |
def stop_line_profiler(): """Stops the line profiler and prints the results""" global _active_line_profiler if not _active_line_profiler: return stream = StringIO() _active_line_profiler.print_stats(stream=stream) _active_line_profiler = None # print the results to the log print(stream.getvalue()) # and copy to the clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(stream.getvalue()) win32clipboard.CloseClipboard() xlcAlert("Line Profiler Stopped\n" "Results have been written to the log and clipboard.")
Example #3
Source File: cmd2plus.py From OpenTrader with GNU Lesser General Public License v3.0 | 5 votes |
def write_to_paste_buffer(txt): win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(txt) win32clipboard.CloseClipboard()
Example #4
Source File: cmd2.py From Beehive with GNU General Public License v3.0 | 5 votes |
def write_to_paste_buffer(txt): win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(txt) win32clipboard.CloseClipboard()
Example #5
Source File: clipboard.py From cross3d with MIT License | 5 votes |
def setText( self, text ): """ \remarks Sets the text hold by the clipboarc. \param text <string> \return <bool> success """ import win32clipboard win32clipboard.OpenClipboard() win32clipboard.SetClipboardText( text ) win32clipboard.CloseClipboard() return True
Example #6
Source File: softimageapplication.py From cross3d with MIT License | 5 votes |
def clipboardCopyText(self, text): """ Set the provided text to the system clipboard so it can be pasted This function is used because QApplication.clipboard sometimes deadlocks in some applications like XSI. Args: text (str): Set the text in the paste buffer to this text. """ import win32clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(text) win32clipboard.CloseClipboard()
Example #7
Source File: cmd2.py From PocHunter with MIT License | 5 votes |
def write_to_paste_buffer(txt): win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(txt) win32clipboard.CloseClipboard()
Example #8
Source File: profiling_tools.py From pyxll-examples with The Unlicense | 5 votes |
def stop_profiling(): """Stop the cProfile profiler and print the results""" global _active_cprofiler if not _active_cprofiler: xlcAlert("No active profiler") return _active_cprofiler.disable() # print the profiler stats stream = StringIO() stats = pstats.Stats(_active_cprofiler, stream=stream).sort_stats("cumulative") stats.print_stats() # print the results to the log print(stream.getvalue()) # and copy to the clipboard win32clipboard.OpenClipboard() win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(stream.getvalue()) win32clipboard.CloseClipboard() _active_cprofiler = None xlcAlert("cProfiler Stopped\n" "Results have been written to the log and clipboard.") # Current active line profiler
Example #9
Source File: cmd2.py From ZEROScan with MIT License | 5 votes |
def write_to_paste_buffer(txt): win32clipboard.OpenClipboard(0) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(txt) win32clipboard.CloseClipboard()
Example #10
Source File: __init__.py From pyrexecd with MIT License | 5 votes |
def recv(self, data): try: text = data.decode(self.session.server.codec) win32clipboard.OpenClipboard(self.session.app.hwnd) win32clipboard.EmptyClipboard() win32clipboard.SetClipboardText(text) win32clipboard.CloseClipboard() except UnicodeError: self.error('encoding error') except pywintypes.error as e: self.error('error: %r' % e) return