Skip to content
This repository has been archived by the owner on May 28, 2022. It is now read-only.

Commit

Permalink
add utils.paste__text
Browse files Browse the repository at this point in the history
  • Loading branch information
dwiel committed Jan 19, 2019
1 parent 5195a47 commit d9c5e43
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions utils.py
Expand Up @@ -19,11 +19,10 @@

def parse_word(word, force_lowercase=True):
word = str(word).lstrip("\\").split("\\", 1)[0]

if force_lowercase:
word = word.lower()
# print(word)
word = mapping.get(word, word)
# print(word)

return word

Expand Down Expand Up @@ -247,12 +246,20 @@ def preserve_clipboard(fn):
def wrapped_function(*args, **kwargs):
old = clip.get()
ret = fn(*args, **kwargs)
sleep(0.1)
clip.set(old)
return ret

return wrapped_function


@preserve_clipboard
def paste_text(text):
clip.set(text)
sleep(0.1)
press('cmd-v')


# The. following function is used to be able to repeat commands by following it by one or several numbers, e.g.:
# 'delete' + optional_numerals: repeat_function(1, 'delete'),
def repeat_function(numberOfWordsBeforeNumber, keyCode, delay=0):
Expand Down

0 comments on commit d9c5e43

Please sign in to comment.