def write_letter(big, letter, accent=None): if accent: if big: letter = letter.upper() combined_letter = unicodedata.normalize('NFC', letter + accent) #Combine only letters that can be combined if len(combined_letter) == 1: letter = combined_letter context.paste_string_without_altering_clipboard(letter) else: if big: Key("shift:down").execute() Text(letter).execute() if big: Key("shift:up").execute()
def enclose_selected(enclosure): ''' Encloses selected text in the appropriate enclosures By using the system Clipboard as a buffer ( doesn't delete previous contents) ''' (err, selected_text) = context.read_selected_without_altering_clipboard(True) if err == 0: opener = enclosure.split('~')[0] closer = enclosure.split('~')[1] enclosed_text = opener + selected_text + closer # Attempt to paste enclosed text without altering clipboard if not context.paste_string_without_altering_clipboard(enclosed_text): print("failed to paste {}".format(enclosed_text))
def paste_it(the_icon): print(the_icon) paste_string_without_altering_clipboard(words[the_icon])
def text_manipulation_paste(text, application): context.paste_string_without_altering_clipboard( text, pause_time=copy_pause_time_dict[application])
def process_unicode(n1, n2, n3, n4, n5='', n6=''): hex = str(n1) + str(n2) + str(n3) + str(n4) + str(n5) + str(n6) character = eval("u'\u%s'" % hex) #Change the paste to Text action when Unicode in Text is supported #Invalid codepoint will just throw an error as expected context.paste_string_without_altering_clipboard(character)