コード例 #1
0
 def _execute_events(self, events):
     original = Clipboard()
     try:
         original.copy_from_system()
     except pywintypes.error, e:
         self._log.warning("Failed to store original clipboard contents:"
                           " %s" % e)
コード例 #2
0
ファイル: _password.py プロジェクト: B-Rich/code-by-voice
 def _process_recognition(self, value, extras): 
   getPassword = Key("w-b/10, s-tab/10, right:8/10, enter, c-f/10") + value + Key('enter/10, escape/10, c-c/10, a-tab/10')
   getPassword.execute()
   clipboard = Clipboard()
   clipboard.copy_from_system(clear = True)
   password = clipboard.get_text()
   action = Text(password)
   action.execute()
コード例 #3
0
 def _process_recognition(self, value, extras):
     getPassword = Key(
         "w-b/10, s-tab/10, right:8/10, enter, c-f/10") + value + Key(
             'enter/10, escape/10, c-c/10, a-tab/10')
     getPassword.execute()
     clipboard = Clipboard()
     clipboard.copy_from_system(clear=True)
     password = clipboard.get_text()
     action = Text(password)
     action.execute()
コード例 #4
0
    def _execute_events(self, events):
        original = Clipboard()
        original.copy_from_system()

        if self.format == win32con.CF_UNICODETEXT:
            events = unicode(events)
        elif self.format == win32con.CF_TEXT:
            events = str(events)

        clipboard = Clipboard(contents={self.format: events})
        clipboard.copy_to_system()
        self.paste.execute()

        original.copy_to_system()
        return True
コード例 #5
0
    def _execute_events(self, events):
        original = Clipboard()
        original.copy_from_system()

        if self.format == win32con.CF_UNICODETEXT:
            events = unicode(events)
        elif self.format == win32con.CF_TEXT:
            events = str(events)

        clipboard = Clipboard(contents={self.format: events})
        clipboard.copy_to_system()
        self.paste.execute()

        original.copy_to_system()
        return True
コード例 #6
0
ファイル: utils.py プロジェクト: haughki/MyDragonflyModules
def getSelectedText():
    """ Get the currently selected text by copying it to the clipboard and pulling it from there.
    Preserve the original clipboard state. """
    original = Clipboard(from_system=True)
    
    # print "original before copy: " + original.get_text()
    
    Key("c-c/5").execute()
    # note that trying to re-use this clipboard object after it's been
    # modified has caused me issues in the past -- seems to hold onto old values...
    just_copied = Clipboard()
    just_copied.copy_from_system()
    
    # print "original after copy: " + original.get_text()
    # print "just copied before original copy back: " + just_copied.get_text()
    
    original.copy_to_system()  # restore the state of the clipboard

    return just_copied.get_text()
コード例 #7
0
ファイル: utils.py プロジェクト: haughki/MyDragonflyModules
def getSelectedText():
    """ Get the currently selected text by copying it to the clipboard and pulling it from there.
    Preserve the original clipboard state. """
    original = Clipboard(from_system=True)
    
    # print "original before copy: " + original.get_text()
    
    Key("c-c/5").execute()
    # note that trying to re-use this clipboard object after it's been
    # modified has caused me issues in the past -- seems to hold onto old values...
    just_copied = Clipboard()
    just_copied.copy_from_system()
    
    # print "original after copy: " + original.get_text()
    # print "just copied before original copy back: " + just_copied.get_text()
    
    original.copy_to_system()  # restore the state of the clipboard

    return just_copied.get_text()
コード例 #8
0
def get_clipboard_as_text():
    clipboard_instance = Clipboard()
    clipboard_instance.copy_from_system()

    return clipboard_instance.text