How to use the pyperclip.copy 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 keethesh / UdemyCourseGrabber / main.py View on Github external
original_course_name = udemy_url

    course_name = original_course_name.replace("-", "")
    course_info = get_sites(course_name)

    if len(course_info) == 0:
        exit("The course wasn't found in any of the sharing websites.")

    download_link = course_info[0].get("link")
    last_updated = str(course_info[0]["month"]) + "/" + str(course_info[0]["year"])
    from_website = course_info[0].get("website")
    print("Download link: " + download_link)
    print("Last updated: " + last_updated)
    print("Fetched from " + from_website)
    if copy_to_clipboard:
        pyperclip.copy(download_link)

    if not filename == "":
        for info in course_info:
            download_link = info.get("link")
            last_updated = str(info["month"]) + "/" + str(info["year"])
            from_website = info.get("website")
            data = {"Course name": original_course_name, "Last updated": last_updated, "Download Link": download_link,
                    "Provider": from_website}
            write_to_file(data, filename)
github Kwpolska / upass / upass / __main__.py View on Github external
entry = line.split(': ', 1)
                if len(entry) > 1:
                    copiable_entries[entry[0]] = entry[1]
                    copiable_keys.append(entry[0])

            if copy:
                if copy_key is False:  # False: copy first line
                    copytarget = text.split('\n', 1)[0]
                    copy_key = 'first line'
                elif copy_key is True:  # True: copy everything
                    copytarget = text
                    copy_key = 'everything'
                else:  # string: copy whatever is passed
                    copytarget = copiable_entries[copy_key]

                pyperclip.copy(copytarget)
                self.box.body.append(
                    urwid.AttrMap(
                        urwid.Text('Copied {0} to clipboard.'.format(copy_key)),
                        'highlight'))
            else:
                self.box.body.append(urwid.Text(text.strip()))

            self.box.body.append(ActionButton('COPY FIRST LINE', self.call_pass,
                                              (self.current, True, False)))
            self.box.body.append(ActionButton('COPY EVERYTHING', self.call_pass,
                                              (self.current, True, True)))

            for k in copiable_keys:
                self.box.body.append(ActionButton('COPY {0}'.format(k), self.call_pass,
                                                  (self.current, True, k)))
        else:
github asweigart / PythonStdioGames / src / railfencecipher.py View on Github external
def copyIfPossible(text):
    """Copy `text` to the clipboard if pyperclip was previously imported."""
    try:
        print('Copied to clipboard.')
        pyperclip.copy(text) # Copy the text to the clipboard.
    except:
        pass # If pyperclip wasn't imported, do nothing.
github daeyun / vim-matlab / rplugin / python / vim_matlab / matlab_gui_controller.py View on Github external
def __type_in_window(self, window_id, string):
        pyperclip.copy(string)
        self.xdotool.enter_keys(['Ctrl+y'], window_id)
github asweigart / codebreaker / caesarCipher2.py View on Github external
num = num - len(LETTERS)
        elif num < 0:
            num = num + len(LETTERS)

        # add encrypted/decrypted number's symbol at the end of translated
        translated = translated + LETTERS[num]

    else:
        # just add the symbol without encrypting/decrypting
        translated = translated + symbol

# print the encrypted/decrypted string to the screen
print(translated)

# copy the encrypted/decrypted string to the clipboard
pyperclip.copy(translated)
github asweigart / codebreaker / transpositionHacker.py View on Github external
def main():
    # You might want to copy & paste this text from the source code at
    # http://invpy.com/transpositionHacker.py
    myMessage = """Cb b rssti aieih rooaopbrtnsceee er es no npfgcwu  plri ch nitaalr eiuengiteehb(e1  hilincegeoamn fubehgtarndcstudmd nM eu eacBoltaeteeoinebcdkyremdteghn.aa2r81a condari fmps" tad   l t oisn sit u1rnd stara nvhn fsedbh ee,n  e necrg6  8nmisv l nc muiftegiitm tutmg cm shSs9fcie ebintcaets h  aihda cctrhe ele 1O7 aaoem waoaatdahretnhechaopnooeapece9etfncdbgsoeb uuteitgna.rteoh add e,D7c1Etnpneehtn beete" evecoal lsfmcrl iu1cifgo ai. sl1rchdnheev sh meBd ies e9t)nh,htcnoecplrrh ,ide hmtlme. pheaLem,toeinfgn t e9yce da' eN eMp a ffn Fc1o ge eohg dere.eec s nfap yox hla yon. lnrnsreaBoa t,e eitsw il ulpbdofgBRe bwlmprraio po  droB wtinue r Pieno nc ayieeto'lulcih sfnc  ownaSserbereiaSm-eaiah, nnrttgcC  maciiritvledastinideI  nn rms iehn tsigaBmuoetcetias rn"""

    hackedMessage = hackTransposition(myMessage)

    if hackedMessage == None:
        print('Failed to hack encryption.')
    else:
        print('Copying hacked message to clipboard:')
        print(hackedMessage)
        pyperclip.copy(hackedMessage)
github asweigart / codebreaker / caesarCipher.py View on Github external
num = num - len(LETTERS)
        elif num < 0:
            num = num + len(LETTERS)

        # add encrypted/decrypted number's symbol at the end of translated
        translated = translated + LETTERS[num]

    else:
        # just add the symbol without encrypting/decrypting
        translated = translated + symbol

# print the encrypted/decrypted string to the screen
print(translated)

# copy the encrypted/decrypted string to the clipboard
pyperclip.copy(translated)
github agarwalsarthak121 / web_crawlers / Magnet_link_copier.py View on Github external
print ('Magnet Link Copied')
    
elif j2 < user_input <= j3:
    url = 'https://kickass.unblocked.li'+list[user_input - 1]
    source_code = requests.get(url)
    soup = BeautifulSoup(source_code.text,'lxml')
    for magnet in soup.findAll('a',{'class':'kaGiantButton '}):
        pyperclip.copy(magnet.get('href'))
        print ('Magnet link Copied')
        
elif j3 < user_input <= j4:
    url = 'http://www.extratorrent.date'+list[user_input - 1]
    source_code = requests.get(url)
    soup = BeautifulSoup(source_code.text,'lxml')
    for magnet in soup.findAll('a',{'title':'Magnet link'}):
        pyperclip.copy(magnet.get('href'))
        print ('Magnet link Copied')
webbrowser.open(pyperclip.paste())
github python-cmd2 / cmd2 / cmd2.py View on Github external
def write_to_paste_buffer(txt):
    """Copy text to the clipboard / paste buffer.

    :param txt: str - text to copy to the clipboard
    """
    pyperclip.copy(txt)
github BlackLight / platypush / platypush / plugins / clipboard.py View on Github external
def copy(self, text):
        """
        Copies a text to the OS clipboard

        :param text: Text to copy
        :type text: str
        """
        import pyperclip
        pyperclip.copy(text)