Пример #1
0
def run_browser():
    config = configparser.ConfigParser()
    try:
        config.read('conf.ini')
        exe = config['browser']['exe']
    except Exception as e:
        exe = 'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe'
    if debug:
        print(f'Opening  browser {exe}')
    subprocess.Popen(exe + " http://play.alienworlds.io")
    time.sleep(2)
    subprocess.Popen(exe + " https://wallet.wax.io/dashboard")
    time.sleep(5)
    #БАГ! На расширении 800х600 нужен костыль для скролла сайта вниз. Допилил ниже
    #Не тестил. Может уйти в вечный  цикл. Надеюсь, что нет. Завтра будем тестить весь код
    # + на ночь 5 серверов поставил
    subprocess.Popen(exe + " https://wax.alcor.exchange/swap?output=WAX-eosio.token&input=TLM-alien.worlds-eosio.token")
    time.sleep(5)
    while True:
        if see("tlm"):
            click(785,793,543,556)
            break
    # Простой способ переключить вкладку
    with keyboard.pressed(Key.ctrl):
        keyboard.press('1')
Пример #2
0
def myMainEvent():
    from pynput.keyboard import Controller, Key
    import time
    keyboard = Controller()

    if Status.my_current_loop == 0:
        with keyboard.pressed(Key.alt):
            keyboard.press(Key.tab)
            keyboard.release(Key.tab)

    time.sleep(0.2)  # Delays for 5 seconds. You can also use a float value.
    '''
    This is infinite loop. The index of loop will start from 0.
    It means the Status.my_current_loop == 0 as above code.
    '''
    if Status.my_current_loop < 16:
        keyboard.type(",\"")
        keyboard.press(Key.end)
        keyboard.release(Key.end)
        keyboard.type("\"")
        keyboard.press(Key.down)
        keyboard.release(Key.down)
        keyboard.press(Key.home)
        keyboard.release(Key.home)
    '''
    with keyboard .pressed(Key.ctrl):
        keyboard.press('v')
        keyboard.release('v')        
    '''
    Status.my_current_loop = Status.my_current_loop + 1
Пример #3
0
    def write(self, text):
        if text == "%{TAB}":
            with keyboard.pressed(key.alt):
                keyboard.press(key.tab)
                keyboard.release(key.tab)
        elif text == "%{TAB 2}":
            with keyboard.pressed(key.alt):
                keyboard.press(key.tab)
                keyboard.release(key.tab)
                time.sleep(0.1)
                keyboard.press(key.tab)
                keyboard.release(key.tab)
        elif text == "%{TAB 3}":
            with keyboard.pressed(key.alt):
                keyboard.press(key.tab)
                keyboard.release(key.tab)
                time.sleep(0.1)
                keyboard.press(key.tab)
                keyboard.release(key.tab)
                time.sleep(0.1)
                keyboard.press(key.tab)
                keyboard.release(key.tab)
        elif text == "%T":
            with keyboard.pressed(key.alt):
                keyboard.type("T")

        elif text == "{DOWN}":
            keyboard.press(key.down)
            keyboard.release(key.down)

        elif text == "{ESC}":
            keyboard.press(key.esc)
            keyboard.release(key.esc)

        elif text == "{F5}":
            #with keyboard.pressed(key.alt):
            keyboard.press(key.f5)
            keyboard.release(key.f5)
        elif text == "{ENTER}":
            #with keyboard.pressed(key.alt):
            keyboard.press(key.enter)
            keyboard.release(key.enter)

        else:
            keyboard.type(text)
Пример #4
0
def select_text(x0=R.x0_select_text,
                y0=R.y0_select_text,
                x1=R.x0_select_text + 1000,
                y1=R.y0_select_text):
    if x0 == R.x0_select_text and y0 == R.y0_select_text and x1 == R.x0_select_text + 1000 and y1 == R.y0_select_text:
        log("Using default configuration you might have errors !")
    else:
        pass
    text_pointeur.position = (x0, y0)
    text_pointeur.press(Button.left)
    text_pointeur.position = (x1, y1)
    text_pointeur.release(Button.left)
    sleep(.01)
    with keyboard.pressed(Key.ctrl):
        keyboard.press('c')
        keyboard.release('c')
    return clipboard.paste()
Пример #5
0
def get_ci():
            a=[1,2]

            with Listener(on_move=on_move, on_click=on_click, on_scroll=on_scroll) as listener:
                listener.join()
                keyboard = Controller()
                
                #检测剪切版里原有的东西
                try:
                    data_first=pyperclip.paste()
                except pyperclip.PyperclipException:
                    
                    data_first=''
                

                with keyboard.pressed(Key.ctrl):
                    

                     keyboard.press('c')
                    
                     time.sleep(0.2)

                     keyboard.release('c')
                
                try:
                    data_later=pyperclip.paste()
                    
                except pyperclip.PyperclipException:
                    
                    data_later='null'
                    
                
                if data_later!='null' and data_later!='':
                    
                    pyperclip.copy(data_first)
                    
                    
                    return data_later
                else:
                    pass
Пример #6
0
 def shift_home_select():
     keyboard = Controller()
     with keyboard.pressed(Key.shift):
         keyboard.press(Key.home)
         keyboard.release(Key.shift)
Пример #7
0
def paste(d):
    keyboard = Controller()
    pyperclip.copy(str(d))
    with keyboard.pressed(Key.ctrl):
        keyboard.press('v')
        keyboard.release('v')
    # Collect events until released
    with keyboard.Listener(on_press=on_press,
                           on_release=on_release) as listener:
        listener.join()

    # ...or, in a non-blocking fashion:
    listener = keyboard.Listener(on_press=on_press, on_release=on_release)
    listener.start()

    from pynput.keyboard import Key, Controller

    keyboard = Controller()

    # Press and release space
    keyboard.press(Key.space)
    keyboard.release(Key.space)

    # Type a lower case A; this will work even if no key on the
    # physical keyboard is labelled 'A'
    keyboard.press('a')
    keyboard.release('a')

    # Type two upper case As
    keyboard.press('A')
    keyboard.release('A')
    with keyboard.pressed(Key.shift):
        keyboard.press('a')
        keyboard.release('a')

    # Type 'Hello World' using the shortcut type method
    keyboard.type('Hello World')
Пример #9
0
    time.sleep(1)
    mouse.position = (481, 443)
    time.sleep(3)
    mouse.click(Button.left, 1)
    time.sleep(1)

    mouse.position = (697, 519)
    time.sleep(1)
    mouse.click(Button.left, 1)
    time.sleep(3)
    mouse.click(Button.left, 1)
    time.sleep(1)
    mouse.position = (481, 441)
    time.sleep(3)
    mouse.click(Button.left, 1)
    time.sleep(1)
    with keyboard.pressed(pynput.keyboard.Key.alt):
        keyboard.press(pynput.keyboard.Key.tab)
        time.sleep(0.01)
        keyboard.release(pynput.keyboard.Key.tab)
    time.sleep(300)
    with keyboard.pressed(pynput.keyboard.Key.alt):
        keyboard.press(pynput.keyboard.Key.tab)
        time.sleep(0.01)
        keyboard.release(pynput.keyboard.Key.tab)
    time.sleep(2)
#    keyboard.press(pynput.keyboard.Key.cmd)
#    time.sleep(0.01)
#    keyboard.release(pynput.keyboard.Key.cmd)
#    time.sleep(2)
Пример #10
0
#     try:
#         listener.join()
#     except MyException as e:
#         print('{0} was clicked'.format(e.args[0]))
# The event listener will be running in this block
# with mouse.Events() as events:
#     for event in events:
#         if event.button == mouse.Button.right:
#             break
#         else:
#             print('Received event {}'.format(event))
keyboard = Controller()

# Press and release space
keyboard.press(Key.space)
keyboard.release(Key.space)

# Type a lower case A; this will work even if no key on the
# physical keyboard is labelled 'A'
# keyboard.press('a')
# keyboard.release('a') AB

# Type two upper case As
keyboard.press('A')
keyboard.release('A')
with keyboard.pressed(Key.alt): A
    keyboard.press('e')
    keyboard.release('b')

# Type 'Hello World' using the shortcut type method
# keyboard.type('Hello World')