Ejemplo n.º 1
0
def mimic_record():
    m = mili_seconds.value
    s = seconds.value
    if record.text == 'Stop Recording':
        if mouse.is_pressed('left') == True:
            x, y = pyautogui.position()
            l = 'left'
            user_entry.append('c:%s x:%s y:%s t:%s.%s' % (l, x, y, s, m))
            entry_box.append('c:%s x:%s y:%s t:%s.%s' % (l, x, y, s, m))
            mili_seconds.value = 0
            seconds.value = 0
            side.append(l)
            xx.append(x)
            yy.append(y)
            mm.append('%s.%s' % (s, m))
            list_count.value = len(user_entry.items)
        elif mouse.is_pressed('right') == True:
            x, y = pyautogui.position()
            r = 'right'
            user_entry.append('c:%s x:%s y:%s t:%s.%s' % (r, x, y, s, m))
            entry_box.append('c:%s x:%s y:%s t:%s.%s' % (r, x, y, s, m))
            mili_seconds.value = 0
            seconds.value = 0
            side.append(r)
            xx.append(x)
            yy.append(y)
            mm.append('%s.%s' % (s, m))
            list_count.value = len(user_entry.items)
        elif keyboard.is_pressed('e'):
            mili_seconds.value = 0
            seconds.value = 0
            record.text = 'Record'
            record.bg = dark_grey
    else:
        None
Ejemplo n.º 2
0
def UserInput(gui, scs, sMscs, inaktiveTime):
    if (keyboard.is_pressed("~")):
        gui.deiconify()
    global lastPosition
    currentPosition = mouse.get_position()
    if (keyboard.is_pressed("space") or keyboard.is_pressed("enter")
            or keyboard.is_pressed("q") or keyboard.is_pressed("w")
            or keyboard.is_pressed("e") or keyboard.is_pressed("r")
            or keyboard.is_pressed("t") or keyboard.is_pressed("z")
            or keyboard.is_pressed("u") or keyboard.is_pressed("i")
            or keyboard.is_pressed("o") or keyboard.is_pressed("p")
            or keyboard.is_pressed("a") or keyboard.is_pressed("s")
            or keyboard.is_pressed("d") or keyboard.is_pressed("f")
            or keyboard.is_pressed("g") or keyboard.is_pressed("h")
            or keyboard.is_pressed("j") or keyboard.is_pressed("k")
            or keyboard.is_pressed("l") or keyboard.is_pressed("y")
            or keyboard.is_pressed("x") or keyboard.is_pressed("c")
            or keyboard.is_pressed("v") or keyboard.is_pressed("b")
            or keyboard.is_pressed("n") or keyboard.is_pressed("m")
            or keyboard.is_pressed("ü") or keyboard.is_pressed("ä")
            or keyboard.is_pressed("ö") or keyboard.is_pressed(",")
            or keyboard.is_pressed(".") or keyboard.is_pressed("-")
            or keyboard.is_pressed("#") or keyboard.is_pressed("+")):
        QuitFullScreen(scs, sMscs, inaktiveTime)
    if (mouse.is_pressed("right")):
        QuitFullScreen(scs, sMscs, inaktiveTime)
    if (mouse.is_pressed("middle")):
        QuitFullScreen(scs, sMscs, inaktiveTime)
    if (mouse.is_pressed("left")):
        QuitFullScreen(scs, sMscs, inaktiveTime)
    if (currentPosition != lastPosition):
        lastPosition = mouse.get_position()
        QuitFullScreen(scs, sMscs, inaktiveTime)
    scs.after(100, UserInput, gui, scs, sMscs, inaktiveTime)
def set_roi():
    global ROI_SET, x1, y1, x2, y2
    ROI_SET = False
    print("Select your ROI using mouse drag.")
    while(mouse.is_pressed() == False):
        x1, y1 = mouse.get_position()
        while(mouse.is_pressed() == True):
            x2, y2 = mouse.get_position()
            while(mouse.is_pressed() == False):
                print("Your ROI : {0}, {1}, {2}, {3}".format(x1, y1, x2, y2))
                ROI_SET = True
                return
Ejemplo n.º 4
0
def getMouseClicks(event):
    global mUnhooked
    global mouseClickLocations
    if keyboard.is_pressed("z"):
        if mouse.is_pressed(button="left"):
            mouseClickLocations.append(mouse.get_position())
    if mouse.is_pressed(button="middle"):
        print("unhooking mouse")
        mouse.unhook(getMouseClicks)
        mUnhooked = True

        if kUnhooked and mUnhooked:
            endOrRestart()
    def mouseDraging(self):
        if not mouse.is_pressed(button="middle"):
            self.startPos = mouse.get_position()

        if mouse.is_pressed(button="middle"):
            change = [0, 0]
            finishPos = mouse.get_position()
            change[0] = (self.startPos[1] - finishPos[1]) / self.resolution[1]
            change[1] = (self.startPos[0] - finishPos[0]) / self.resolution[0]
            self.globalRotate[0] = (self.globalRotate[0] +
                                    360 * change[0]) % 360
            self.globalRotate[1] = (self.globalRotate[1] +
                                    360 * change[1]) % 360
            self.startPos = finishPos
        return
Ejemplo n.º 6
0
def stream_markers():
    # first create a new stream info (here we set the name to MyMarkerStream,
    # the content-type to Markers, 1 channel, irregular sampling rate,
    # and string-valued data) The last value would be the locally unique
    # identifier for the stream as far as available, e.g.
    # program-scriptname-subjectnumber (you could also omit it but interrupted
    # connections wouldn't auto-recover). The important part is that the
    # content-type is set to 'Markers', because then other programs will know how
    #  to interpret the content
    # info = StreamInfo('Markers', 'Markers', 1, 0, 'string', 'myuidw43536')
    info = StreamInfo(
        'Markers',
        'Markers',
        1,
        channel_format='int8',
        source_id='myuidw37823',
    )

    # next make an outlet
    outlet = StreamOutlet(info)

    print("Started markers stream...")
    while True:
        try:
            # pick a sample to send an wait for a bit
            if keyboard.is_pressed('space') or mouse.is_pressed():
                sample = 1
            else:
                sample = 0
            # print(time.time())
            # print(sample)
            outlet.push_sample([sample], timestamp=time.time())
            time.sleep(0.004)
        except KeyboardInterrupt:
            break
Ejemplo n.º 7
0
def input():
    a1 = pyautogui.position().x
    a2 = pyautogui.position().y
    sleep(0.2)
    while True:
        b1 = pyautogui.position().x
        b2 = pyautogui.position().y
        if mouse.is_pressed(button='middle'):
            break
    temp1 = a1
    temp2 = a2
    if b2 - a2 < 0 and b1 - a1 < 0:
        a1 = b1
        a2 = b2
        b1 = temp1
        b2 = temp2
    elif b2 - a2 > 0 and b1 - a1 < 0:
        a1 = b1
        b1 = temp1
    elif b2 - a2 < 0 and b1 - a1 > 0:
        a2 = b2
        b2 = temp2

    grab(bbox=(a1, a2, b1, b2)).save('screen.png')
    screen = Image.open('screen.png')
    """
    display = pygame.display.set_mode(screen.size)
    showimage = pygame.image.load('screen.png')
    display.blit(showimage, (0, 0))
    pygame.display.update()
    """
    vocab = pytesseract.image_to_string(screen)
    sent = '\n' + vocab + "\n" + translator.translate(vocab, dest='th').text
    lineNotify(sent)
Ejemplo n.º 8
0
def main():
    print('externpy')

    client = pymem.process.module_from_name(pm.process_id, 'client.dll')
    local = client.base_address + local_offset
    l_flags = pm.read_int(local) + flags_offset
    l_team = pm.read_int(local) + team_offset
    in_cross = pm.read_int(local) + in_cross_offset

    while True:
        local_flags = pm.read_int(l_flags)
        local_team = pm.read_int(l_team)
        entity_index = pm.read_int(in_cross)

        if mouse.is_pressed('right'):
            if entity_index > 0 and entity_index <= 32:
                ent = pm.read_int((client.base_address + entity_offset +
                                   (entity_index - 1) * 0x10))
                if local_team != pm.read_int(ent + team_offset):
                    pm.write_int(client.base_address + force_attack, 5)
                    time.sleep(0.01)
                    pm.write_int(client.base_address + force_attack, 4)

        if local_flags == 257 and keyboard.is_pressed('shift'):
            pm.write_int(client.base_address + force_jump, 6)
            time.sleep(0.01)
Ejemplo n.º 9
0
def record():
    k.start_recording()
    positions = []
    i = 0
    while True:
        positions.append(
            (m.X, m.X2, m.is_pressed(button='left'),
             m.is_pressed(button='right'), m.is_pressed(button='middle')))
        p.screenshot('frames/{}.png'.format(i))
        if k.is_pressed('escape'):
            break
        sleep(sample_rate)
        i += 1
    keys = k.stop_recording()
    print(positions)
    print(keys)
Ejemplo n.º 10
0
def fishing_farm():
    print('Program started')
    print('Hold + to start farming')
    print('Hold - to stop farming')
    print('Hold * to exit the program')

    while True:
        sleep(0.5)
        if kb_is_pressed('*'):
            print('Exiting Program')
            exit(0)

        if kb_is_pressed('+'):
            print('Starting Farm')
            start = datetime.datetime.now()
            while True:
                sleep(0.5)
                if not is_pressed('right'):
                    press(button='right')

                if kb_is_pressed('-'):
                    print('Farm stopped')
                    release(button='right')
                    break

                if kb_is_pressed('*'):
                    print('Exiting Program')
                    release(button='right')
                    exit(0)

                if datetime.datetime.now() - start > datetime.timedelta(
                        minutes=3):
                    send_afk_message()
                    start = datetime.datetime.now()
Ejemplo n.º 11
0
def change_skill():
    #If the mouse is presses, whe change the actual state and press the key related to this state
    if (mouse.is_pressed(mouse.LEFT)):
        change_actual_state()
        keyboard.press_and_release(skills_states[actual_state])
        print("The State Got Changed to " + str(skills_states[actual_state]))
        time.sleep(0.3)
Ejemplo n.º 12
0
def START_session():
    print("Choose the position you need by cursor and right-click on it:\n")
    while True:
        if mouse.is_pressed(button='right'):  #left
            print('Gotcha')
            x, y = choose_posintion()
            return x, y
Ejemplo n.º 13
0
def pressright():
    if (mouse.is_pressed(button='right')):
        # release
        mouse.release(button='right')

    else:
        # press
        mouse.press(button='right')
Ejemplo n.º 14
0
def pressleft():
    if (mouse.is_pressed(button='left')):
        # release
        mouse.release(button='left')

    else:
        # press
        mouse.press(button='left')
Ejemplo n.º 15
0
def mouse_callback(event, x, y, flags, param):
    global max_count
    if mouse.is_pressed("left"):
        point.append(gui.position())
        print(x,y)
        max_count=max_count+1
        print(max_count)
        time.sleep(0.1)
Ejemplo n.º 16
0
def continue_left_click():
    while True:
        if mouse.is_pressed('left'):
            pos = mouse.get_position()
            print("\r{:40}".format("Left click {}".format(pos)))
            mouse.press('left')
            mouse.release('left')
            mouse.press('left')
        time.sleep(float(CONFIG_DICT[CONFIG_KEY_INTERVAL_LEFT_CLICK]))
Ejemplo n.º 17
0
def getDistance():
    while(1):
        try:
            text=ser.readline()
            text=text.decode()
            if text!='':
                #print(text)
                dis = int(text)
                if dis<=20:
                    if ~mouse.is_pressed():
                        mouse.press()
                        #mouse.click(button='left');
                        print("clicked")
                else:
                    if mouse.is_pressed():
                        mouse.release()
            #time.sleep(.03)
        except:
            break;
Ejemplo n.º 18
0
def mouse_callback(event, y, x, flags, param):
    global max_count, table
    if mouse.is_pressed("left"):
        point.append([x, y])
        color.append(param[x][y])
        print(x, y)
        max_count = max_count + 1
        time.sleep(0.1)
    if max_count == table:
        cv.destroyAllWindows()
    def GetObjectClicked(self):
        if mouse.is_pressed(button="left"):
            inScreenSpace, pos = self.GetMouseScreenPos()

            if inScreenSpace:
                for loop in range(len(self.PieceList)):
                    if InsidePolygon(pos,
                                     self.PieceList[loop].GetRotatedPoints()):
                        return self.PieceList[loop], loop
        return None
Ejemplo n.º 20
0
def key_mouse_check():
    inputs_event = []
    for button in available_inputs:
        if keyboard.is_pressed(button):
            inputs_event.append(button)
    for button_prime in available_inputs_2:
        if mouse.is_pressed(button=button_prime):
            inputs_event.append(button_prime)

    return inputs_event
Ejemplo n.º 21
0
def poll_mouse(ts):
    if ts - ScriptState.last_mouse_poll_time < config.mouse_poll_time:
        return
    ScriptState.last_mouse_poll_time = ts
    GameState.is_firing = (mouse.is_pressed('left')
                           and GameState.screen == Screens.play)

    if GameState.is_firing:
        if GameState.fire_start_time is None:
            GameState.fire_start_time = ts
Ejemplo n.º 22
0
def denote_mine_for_mouse(key):
    frequency = 5000  # Set Frequency To 2000 Hertz
    duration = 100  # Set Duration, 1000 ms == 1 second
    for i in range(2):
        winsound.Beep(frequency, duration)
    while 1:
        if mouse.is_pressed(button=key) and GetWindowText(
                GetForegroundWindow()) == 'Path of Exile':
            # if mouse.is_pressed(button=key):
            time.sleep(0.4)
            keyboard.press_and_release('d')
Ejemplo n.º 23
0
def record_mouse():
    status = ""
    if mouse.is_pressed(button="left"):
        status = "1"
    else:
        status = "0"
    position = str(mouse.get_position())
    text.write(position + status + "\n")
    print(position + status + "\n")

    time.sleep(0.01)
Ejemplo n.º 24
0
def handle_click():
    while True:
        if is_pressed(button='left'):
            click(button='left')
            continue

        try:
            driver.find_element_by_id("bigCookie").click()
            average_cps.add_click()
        except:
            continue
Ejemplo n.º 25
0
def macro():
    #Text
    print('----------------------------------------------------------------')
    print('|------Это простой макрос для помощи в Pubg------|')
    print('|------Нажмите клавишу X, чтобы включить и выключить макрос.------')
    # Recoil

    m416 = [19, 19, 19, 19, 19, 19, 19, 19, 19, 21, 21, 22, 19, 21, 22, 22, 23, 24, 24, 32,
            31, 31, 31, 31, 31, 31, 31, 32, 32, 32, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35, 35]

    # vars
    count = 0
    EinAus = False
    jaornein = randint(0, 1)

    # Loop
    count = 0
    while True:
        if win32api.GetAsyncKeyState(ord('X')):
            EinAus = not EinAus
            sleep(0.2)
            print('On')
        sleep(0.2)
        while EinAus is True:
            count = 0
            while mouse.is_pressed(button='left'):
                if count < 40:
                    jaornein = randint(0, 1)
                    if jaornein == 1:
                        randomized = randint(0, 5)
                    elif jaornein == 0:
                        randomized = random.uniform(0, -5)
                    print(randomized)
                    ammount = m416[count]
                    if jaornein == 1:
                        ammount = ammount + randomized
                    elif jaornein == 0:
                        ammount = ammount - randomized
                    ammountFinal = int(round(ammount))
                    win32api.mouse_event(0x0001, 0, ammountFinal)
                    sleep(0.10)
                count = count + 1
                if count > 40:
                    count = 0
                    ammount = 0
            if win32api.GetAsyncKeyState(ord('X')):
                print('Out')
                EinAus = not EinAus
                sleep(0.2)
                break
            sleep(0.1)
Ejemplo n.º 26
0
def switch():
    mouse = mouse()
    if (kb.is_pressed("1")):
        ps(recording)
        while (not mouse.is_pressed("left")):
            x = 0
        dict["BUSCAR"] = mouse.get_position()
        ps(recorded)

    elif (kb.is_pressed("2")):
        ps(recording)
        while (not mouse.is_pressed("left")):
            x = 0
        dict["COLOR_ACEPTAR"] = dame_colores()
        dict["ACEPTAR"] = mouse.get_position()
        ps(recorded)

    #elif (kb.is_pressed("3")):
    #    ps(recording)
    #    while(not mouse.is_pressed("left")):
    #        x=0
    #    dict["COLOR_RENDIRSE"] = dame_colores()
    #    dict["RENDIRSE"] = mouse.get_position()
    #    ps(recorded)

    elif (kb.is_pressed("3")):
        ps(recording)
        while (not mouse.is_pressed("left")):
            x = 0
        dict["SEGURO"] = mouse.get_position()
        ps(recorded)

    elif (kb.is_pressed("4")):
        ps(recording)
        while (not mouse.is_pressed("left")):
            x = 0
        dict["OTRA"] = mouse.get_position()
        ps(recorded)
    def getObjectClicked(self):
        if mouse.is_pressed(button="left"):
            pos = mouse.get_position()
            pos = [
                pos[0] - self.windowPostion[0], pos[1] - self.windowPostion[1]
            ]
            face2DList = self.objects_to_2DFaceList(self.object3D_list,
                                                    self.globalRotate)
            face2DList = face2DList[::-1]

            for loop in range(len(face2DList)):
                if self.inside_polygon(pos[0], pos[1], face2DList[loop][1]):
                    return self.object3D_list[face2DList[loop][3]]
        return None
Ejemplo n.º 28
0
def setting():
    conf = open('settings.conf', 'wt', encoding='utf-8')
    print("Left Click on Left Upper Side")
    request = False
    while (1):
        if MS.is_pressed():
            left_upper = MS.get_position()
            break
    print("Right Click on Right Lower Side")
    while (1):
        if MS.is_pressed(MS.RIGHT):
            right_lower = MS.get_position()
            break
    hotkey = 'Hotkey = ctrl+alt'

    conf.write('Left_Upper = ' + str(left_upper[0]) + ',' +
               str(left_upper[1]) + '\n')
    conf.write('Size = ' + str(right_lower[0] - left_upper[0]) + ',' +
               str(right_lower[1] - left_upper[1]) + '\n')
    conf.write(hotkey)
    conf.close()
    print('Setting Complete')
    '''
Ejemplo n.º 29
0
def OnMouseEvent(event):
    ### unhook the mouse
    if mouse.is_pressed(button='middle'):
        print("unhooking mouse")
        mouse.unhook(OnMouseEvent)
        global mouseStatus
        mouseStatus = True

        if (mouseStatus and keyboardStatus):
            MainLoop()

    if type(
            event
    ).__name__ == 'ButtonEvent' and event.event_type == 'down':  ### is this a button click?
        currentTime = event.time
        previousTime = 0

        ### grab the last event time if available
        if mouseEvents != []:
            previousTime = mouseEvents[-1][4]

        button = event.button
        location = mouse.get_position()
        eventTime = event.time

        ### need to also get the currently focused window
        window = GetWindowText(GetForegroundWindow())

        ### this is just to get the name of the window if we click on an out of focus window
        if window == '' and not 0 <= location[0] <= 45 and not 765 <= location[
                1] <= 729:  ### start button on windows
            ### simulate a button click
            pyautogui.click(clicks=1)

        if currentTime - previousTime < 0.40:
            ### remove the previous event
            if (currentTime - previousTime <
                    0.006):  ### this must be a simulated click
                mouseEvents[-1] = ('mouse', button, location, window,
                                   eventTime)
            else:
                del mouseEvents[-1]
                mouseEvents.append(
                    ('mouse', 'double', location, window, eventTime))
        else:
            mouseEvents.append(('mouse', button, location, window, eventTime))

    return True
Ejemplo n.º 30
0
def Mouse_control(line):
    for i in range(len(line)):
        if line[i] == ",":
            x = line[1:i]
            y = line[i + 2:-3]
            state = line[len(line) - 2]
    print "x=", x, "y=", y, "state =", state, "\n"
    if mouse.is_pressed(button="middle"):
        exit()
    mouse.move(int(x), int(y), absolute=True, duration=0)
    if state == "1":
        mouse.press(button='left')
        print "\a"
    elif state == "0":
        mouse.release(button='left')
    time.sleep(0.01)