Example #1
0
def toggleText(text):
    prevText = text
    text = text.upper()
    if text == prevText:
        text = text.lower()
    setClipboardData(text)
    sendPasteKey()
    sendLefts(len(text), True)
Example #2
0
def urlShortener(text):
    from urllib2 import Request, urlopen, URLError

    request = Request('http://is.gd/api.php?longurl=' + text.strip())

    try:
        response = urlopen(request)
        shortURL = response.read()
        setClipboardData(shortURL)
        sendPasteKey()
    except URLError:
        pass
Example #3
0
def hyphenateText(text):
    setClipboardData(text.replace(" ", "-"))
    sendPasteKey()
Example #4
0
def hashtagText(text):
    import re
    textAlphaOnly = re.sub(r'\W+', '', text)
    hashtag = "#" + textAlphaOnly.lower()
    setClipboardData(hashtag)
    sendPasteKey()
Example #5
0
def twiddle(text):
    setClipboardData(text[::-1])
    sendPasteKey()
Example #6
0
def surroundWithTags(beginTag, endTag, text):
    trimmer = re.compile("^(\s*)(.*[^\s])(\s*)$")
    matches = trimmer.match(text)
    setClipboardData(matches.group(1) + beginTag + matches.group(2)
                     + endTag + matches.group(3))
    sendPasteKey()
Example #7
0
def outputTags(beginTag, endTag):
    setClipboardData(beginTag + endTag)
    sendPasteKey()
    sendLefts(len(endTag.decode('utf-8')))
Example #8
0
def upperText(text):
    setClipboardData(text.upper())
    sendPasteKey()
Example #9
0
def lowerText(text):
    setClipboardData(text.lower())
    sendPasteKey()