How to use the pyperclip.paste function in pyperclip

To help you get started, we’ve selected a few pyperclip examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github crew102 / reprexpy / tests / View on Github external
def test_output_to_clipboard():
    _reprex_basic('x = "hi there"; print(x)')
    assert pyperclip.paste() == '```python\nx = "hi there"; ' \
                                'print(x)\n#> hi there\n```'
github asweigart / codebreaker / View on Github external
def test_transpositionEncryptProgram(self):
        proc = subprocess.Popen('c:\\python32\\python.exe', stdout=subprocess.PIPE)
        procOut = proc.communicate()[0].decode('ascii')

        # encrypting 'Common sense is not so common.' with key 8
        self.assertEqual(procOut, 'Cenoonommstmme oo snnio. s s c|\n')
        self.assertEqual(pyperclip.paste().decode('ascii'), 'Cenoonommstmme oo snnio. s s c')
github JamesHopbourn / Apple-Automation / Python Script / Clipboard to View on Github external
#-*- coding:utf-8 -*-
#  Clipboard to
#  Clipboard to Reminders
#  Created by James Hopbourn on 2019/12/11.
#  Copyright © 2019 James Hopbourn. All rights reserved.

import os
import pyperclip
clipboard = pyperclip.paste()

list = clipboard.split('\n')
name = list[0]
body = '\n'.join(list)

cmd = """osascript -e 'tell application "Reminders"
	make new reminder at list "Drafts" with properties {name:"namehere", body:"bodyhere"}
end tell'"""
cmd = cmd.replace("namehere", name)
cmd = cmd.replace("bodyhere", body)

def addreminders():
github ex2tron / MyLibsAndSamples / 008.列出目录中特定后缀的所有文件 / View on Github external
        for item in os.listdir(folder):
            # 如果是文件夹,则跳过
            if os.path.isdir(os.path.join(folder, item)):
            if postfix == '*':
            elif os.path.splitext(item)[1] == postfix:

    return ret

# 要操作的文件夹
folder_path = pyperclip.paste()
# 后缀名
postfix = sys.argv[1]
# 是否包含子目录
is_contain_subfolders = False if len(sys.argv) < 3 else bool(sys.argv[2])

result = get_file_names(folder_path, postfix=postfix,
for item in result:
github honix / Pyno / pyno / View on Github external
if symbol == key.TAB:
            self.change = True
            self.document.insert_text(self.caret.position, '  ')
            self.caret.position += 2

        elif modifiers & key.MOD_CTRL and symbol == key.ENTER:
            print('Reload code')

        elif modifiers & key.MOD_CTRL:
            if symbol == key.C and self.caret.mark:
            elif symbol == key.V:
                start = min(self.caret.position, self.caret.mark or self.caret.position)
                end = max(self.caret.position, self.caret.mark or self.caret.position)
                text = pyperclip.paste()
                self.document.delete_text(start, end)
                self.document.insert_text(self.caret.position, text)
                self.caret.position += len(text)
                self.caret.mark = self.caret.position
            elif symbol == key.X and self.caret.mark:
                start, end = self.copy_text()
                self.document.delete_text(start, end)
                self.caret.mark = self.caret.position

        elif symbol == key.BACKSPACE or symbol == key.DELETE:
            self.change = True
github asweigart / pyperclip / src / pyperclip / View on Github external
import pyperclip
import sys

if len(sys.argv) > 1 and sys.argv[1] in ('-c', '--copy'):
elif len(sys.argv) > 1 and sys.argv[1] in ('-p', '--paste'):
    print('Usage: python -m pyperclip [-c | --copy] | [-p | --paste]')
    print('When copying, stdin will be placed on the clipboard.')
    print('When pasting, the clipboard will be written to stdout.')
github voussoir / else / Toolbox / View on Github external
def contentreplace_argparse(args):
    filenames = glob.glob(args.filename_glob)

    if args.clip_prompt:
        replace_from = input('Ready from')
        if not replace_from:
            replace_from = pyperclip.paste()
        replace_to = input('Ready to')
        if not replace_to:
            replace_to = pyperclip.paste()
        replace_from = codecs.decode(args.replace_from, 'unicode_escape')
        replace_to = codecs.decode(args.replace_to, 'unicode_escape')

    for filename in filenames:
github mcnemesis / globalclipboard / clipclients / python / clip_client / View on Github external
if self.session_key is None:
                #try to login then...
                r = requests.request('post',"%s/register" % self._conf['server']['url'], data = {'email' : self.creds['email'] , 'password' : self.creds['password'] })
                rj = r.json
                if r.ok and rj['status'] == 200:
          "Registration Successfull: %s" % rj['payload'])
                    #since's we've just registered... give user 1 min to complete registration before using clip client again
                    t = Timer(60,self.run_clipclient) 
                    logging.error("Registration Not Completed : %s" % rj['payload'])
                    #possibly, registration not complete yet or activation not yet done. delay for like 2 min now before trying again
                    t = Timer(120,self.run_clipclient) 
                #we have session key, so...
                #check if there's anything here on the clipboard that needs to be copied over...
                current_local_clip = pyperclip.paste()

                if (self._current_action_mode == ActionMode.RECEIVE_SEND ) or (self._current_action_mode == ActionMode.SEND_ONLY):
                    if self.local_clipboard != current_local_clip:
                        #there's new stuff on the local clip to copy over...
                        #First, secure the paste...
                        secure_local_clip = self.encrypt_clip(current_local_clip,self.encryption_conf)
                        #then send
                        r = requests.request('post',"%s/paste" % self._conf['server']['url'], data = {'session' : self.session_key , 'paste' : secure_local_clip })
                        rj = r.json
                        if r.ok and rj['status'] == 200:
                            logging.debug('Copying to Global Clipboard Successful : %s' % rj['payload'])
                            self.local_clipboard = current_local_clip
                            t = Timer(10,self.run_clipclient) 
                                print secure_local_clip
github mozilla / iris_firefox / iris / api / core / View on Github external
def get_clipboard():
        """Return the content copied to clipboard."""
        return pyperclip.paste()