示例#1
0
def get_current_volume(type='output'):
    cmd = 'get volume settings'
    settings = myosascript.run(cmd)
    # assert len(settings) == 1, "Wrong output: %s" % cmd
    # assert type(settings[0]) == str, "Wrong type of: %s" % settings[0]
    # assert len(settings[0].split(', ')) == 4, "Wrong format of: %s" % settings[0].split(', ')
    # assert len(settings[0].split(', ')[0].split(':')) == 2, "Wrong format of: %s" % settings[0].split(', ')[0]
    # assert type(settings[0].split(', ')[0].split(':')[1]) == str, "Wrong type of: %s" % settings[0].split(', ')[0].split(':')[1]
    return int(
        settings[0].split(', ')[0].split(':')[1]) if type == 'output' else int(
            settings[0].split(', ')[1].split(':')[1]) if type == 'input' else 0
示例#2
0
def press_space():
    myosascript.run(TMPL_K % '49')
示例#3
0
def press_esc():
    myosascript.run(TMPL_K % '53')
示例#4
0
def brightness_down():
    myosascript.run(TMPL_K_U % ('107', 'function down'))
示例#5
0
def brightness_up():
    myosascript.run(TMPL_K_U % ('113', 'function down'))
示例#6
0
def keystroke_return():
    myosascript.run(TMPL_KS % 'return')
示例#7
0
def keystroke(val):
    myosascript.run(TMPL_KS % '"' + val + '"')
示例#8
0
def press_return():
    myosascript.run(TMPL_K % '36')
示例#9
0
def press_enter():
    myosascript.run(TMPL_K % '76')
示例#10
0
def press_right():
    myosascript.run(TMPL_K % '124')
示例#11
0
def press_left():
    myosascript.run(TMPL_K % '123')
示例#12
0
def press_up():
    myosascript.run(TMPL_K % '126')
示例#13
0
def press_down():
    myosascript.run(TMPL_K % '125')
示例#14
0
def press_delete():
    myosascript.run(TMPL_K % '51')
示例#15
0
def unlock():
    myosascript.run(TMPL % 'click at {0, 0}')
    myosascript.run(TMPL_KS % '2002')
    myosascript.run(TMPL_K % '76')
示例#16
0
def set_input_volume(val):
    myosascript.run('set volume input volume %s' % val)