Beispiel #1
0
def getclipbloard():
    """
    Returns as a string the data on the clipboard
    """

    sa = OSAX()
    return sa.the_clipboard()
def get_readkit_info():
    """Activates ReadKit and gets the title and url for the selected post"""
    
    app(u'ReadKit').activate()

    # try first method which is for rss display. 
    # If it is in web display mode this will trigger exception
    
    try:
        # UI element for Title is 3 lines: [blog name, title ,  date]
        title_info= app(u'System Events').application_processes[u'ReadKit'].windows[1].splitter_groups[1].scroll_areas[1].UI_elements[1].UI_elements[1].name.get()
        title = title_info.split('\n')[1]
        
        # click the menu for "Copy Link"
        app(u'System Events').application_processes[u'ReadKit'].menu_bars[1].menu_bar_items[7].menus[1].menu_items[1].click()
    
        sa = OSAX()
        link = sa.the_clipboard()
        
        
    except:
        
        # second method assumes it's a web display which is a lost cause getting out of ReadKit
        # send it to Safari instead
        
        app(u'System Events').keystroke("b")
        app(u'Safari').activate()
        title = app(u'Safari').windows[1].current_tab.name.get() 
        link = app(u'Safari').windows[1].current_tab.URL.get()
        
    return [title, link]
Beispiel #3
0
def main():
    sa = OSAX()
    url = sa.the_clipboard()
    
    print url
    
    post =  getpostnum(url)
    opentreeapp(post)
Beispiel #4
0
def main(argv=None):

    app(u'/Applications/MarsEdit.app').activate()
    time.sleep(1)
    SE = app(u'System Events')
    SE.keystroke(u'c',using=k.command_down)
    sa = OSAX()
    text = sa.the_clipboard().split('\r')
    out = []
    for l in text:
        out.append(titlecase(l))
    
    out_text = '\r'.join(out)
    sa.set_the_clipboard_to( out_text )
    SE.keystroke(u'v',using=k.command_down)
def shortenReadKit():
    ReadKit = app(u'/Applications/ReadKit.app')
    ReadKit.activate()
    SE = app(u'System Events')
    SE.keystroke('c', using=[k.command_down,k.option_down])
    time.sleep(1)
    sa = OSAX()
    url = sa.the_clipboard()

    print url

    short_url = shorten(url)
    sa.set_the_clipboard_to(short_url)
    
    print short_url
def shortenReeder():
    Reeder = app(u'/Applications/Reeder.app')
    Reeder.activate()
    SE = app(u'System Events')
    SE.keystroke('c', using=k.control_down)
    
    sa = OSAX()
    url = sa.the_clipboard()

    print url

    short_url = shorten(url)
    sa.set_the_clipboard_to(short_url)
    
    print short_url
Beispiel #7
0
def insert_text_cb(text):
    
    sa = OSAX()

    # save old clipboard (only text part)
    oldtext = sa.the_clipboard()
    
    # put our text on clipboard
    sa.set_the_clipboard_to(text)
 
    # paste clipboard
    ME = app(u'System Events').application_processes[u'MarsEdit']
    ME.menu_bars[1].menu_bar_items[4].menus[1].menu_items[6].click()

    # restore old clipboard 
    # need to pause so we don't replace clipboard before it is pasted
    time.sleep(.5)

    sa.set_the_clipboard_to( oldtext )
Beispiel #8
0
def insert_text_cb(text):

    sa = OSAX()

    # save old clipboard (only text part)
    oldtext = sa.the_clipboard()

    # put our text on clipboard
    sa.set_the_clipboard_to(text)

    # paste clipboard
    ME = app(u'System Events').application_processes[u'MarsEdit']
    ME.menu_bars[1].menu_bar_items[4].menus[1].menu_items[6].click()

    # restore old clipboard
    # need to pause so we don't replace clipboard before it is pasted
    time.sleep(.5)

    sa.set_the_clipboard_to(oldtext)