Exemple #1
0
    def start_read_keyloggers_callback(self):
        """
        Inicia el callback para contar las teclas pulsadas
        """
        keyboard.hook(self.callback_keyboard)

        if self.MOUSE_ENABLED:
            mouse.on_click(self.callback_mouse, ('left', ))
            mouse.on_right_click(self.callback_mouse, ('right', ))
            mouse.on_middle_click(self.callback_mouse, ('middle', ))
Exemple #2
0
        self.pressed = []

    def add_pirate(self):
        if self.adding:
            self.pirates.append(Window())

    def lock_pirates(self, *args):
        self.adding = False

    def key_down(self, event):
        print(event.name)
        if event.name in self.conversions.keys():
            for win in self.pirates:
                win.key_down(self.conversions[event.name])
                self.pressed.append(event.name)


if __name__ == "__main__":
    controller = Controller()
    mouse.on_right_click(controller.add_pirate)
    keyboard.on_press_key("`", controller.lock_pirates)

    keyboard.on_press(controller.key_down)
    while True:
        for name in controller.pressed:
            if not keyboard.is_pressed(name):
                for win in controller.pirates:
                    win.key_up(controller.conversions[name])
                controller.pressed.remove(name)

        pos_xy[1]) + ",0.5)"
    py_pos_src = prnt + moving + "\n" + "pyautogui.click(" + str(
        pos_xy[0]
    ) + "," + str(
        pos_xy[1]
    ) + ")" + "\n" + "pyautogui.typewrite('*')" + "\n" + "time.sleep(" + str(
        TIME_SLEEP) + ")" + "\n\n"  # 改行コード含む
    all_py_src = all_py_src + py_pos_src
    pyperclip.copy(all_py_src)


callback = say_hello  #左クリック
callback2 = say_hello2  #右クリック

mouse.on_click(callback)  #クリックで関数呼び出し
mouse.on_right_click(callback2)  #右ボタンで関数呼び出し

pyperclip.copy("")  # クリップボードクリアー
global loop
loop = 1
strt_flg = 0
cntr = 0  #クリック、入力の位置にシーケンシャルNO.をつける
pyautogui.alert('記録を開始しますか?')  #プログラムストップ:OKボタンのクリックを待つ
strt_flg = 1

#---------------------------------------------------
if __name__ == '__main__':
    while (loop):
        pyautogui.alert(
            '操作記録を開始しました!!\n終了するにはOKボタンをクリック')  # プログラムストップ:OKボタンのクリックを待つ
        loop = 0
Exemple #4
0
import pyscreeze
import mouse
import time
import win32api
import win32con


def record_frames():
    x, y = win32api.GetCursorPos()
    print(x)
    print(y)
    print(pyscreeze.pixel(x, y))


if __name__ == "__main__":
    mouse.on_right_click(record_frames)
    while True:
        pass
Exemple #5
0
 def runTracker(self):
     mouse.on_right_click(lambda: self.rightClick())
     mouse.on_click(lambda: self.leftClick())
import pyautogui
import time
import mouse

#------------------------------------------------------------*
#マウスの右ポタンでカーソルの位置取得
#終了は一番上にマウスのカーソル持っていく
#--------------------------------------------------------------------------*
print("マウスの右ポタンでカーソルの位置を取得します。")
print("終了するにはマウスを一番上まで持っていくか、Ctrl+Cで終了します。")
print("左クリックでは何も起きません。")
#--------------------------------------------------------------------------*
loop = 1
while (loop):
    time.sleep(2)
    mouse.on_right_click(lambda: print(mouse.get_position()))  #右ボタンが押された?
    m_xy = mouse.get_position()
    if m_xy[1] == 0:  #Y軸のマウスの位置がゼロのときにブレイク
        rtn = pyautogui.confirm('終了しますか?')
        if rtn == 'OK':  #終了します
            break
    #print(mouse.get_position()[1])
Exemple #7
0
try:
    randmin = int(randmin)
    randmax = int(randmax)
    toggle_hotkey = keyboard.add_hotkey(hotkey, toggle_grumby)
except:
    messagebox.showerror(
        "MOYORAL RESERVOIR ERROR",
        "There was an error loading settings. All settings were reset to default"
    )
    saveFile = open('../config/hotkey.txt', "w")
    saveFile.write("ctrl+g\n1\n9\nFalse")
    saveFile.close()
    toggle_hotkey = keyboard.add_hotkey(hotkey, toggle_grumby)

# Calls the press_random_num_key function for every mouse click. The function does nothing if Grumby is deactivated, but it is called every mouse click if grumby is open
mouse.on_right_click(press_random_num_key)

########## - Create the GUI - ##########
# Create window
window = Tk()
window.title("Grumby v0.1")
window.geometry('407x308')
window.resizable(width=False, height=False)

# Set the default background
style = Style()
change_background("deactivated")

# Create the frame used in the settings
mainFrame = Frame(window)
hotkeyFrame = Frame(mainFrame, style='TFrame')
Exemple #8
0
def interact_pressed():
    keyboard.press_and_release(config.GameKeys.use_redirect)
    screenshot(time.perf_counter(), force_update=True)


if __name__ == '__main__':
    last_info = None

    keyboard.on_press_key(config.HotKeys.toggle_script,
                          lambda _: toggle_script())
    keyboard.on_press_key(config.HotKeys.reset_state, lambda _: reset_state())

    keyboard.on_press_key(config.GameKeys.toggle_inventory,
                          lambda _: toggle_inventory())
    keyboard.on_press_key(config.GameKeys.toggle_map, lambda _: toggle_map())
    mouse.on_right_click(toggle_ads)

    keyboard.on_press_key(config.HotKeys.zoom_1x, lambda _: set_zoom(Zooms.x1))
    keyboard.on_press_key(config.HotKeys.zoom_2x, lambda _: set_zoom(Zooms.x2))
    keyboard.on_press_key(config.HotKeys.zoom_3x, lambda _: set_zoom(Zooms.x3))
    keyboard.on_press_key(config.HotKeys.zoom_4x, lambda _: set_zoom(Zooms.x4))
    keyboard.on_press_key(config.HotKeys.zoom_6x, lambda _: set_zoom(Zooms.x6))

    keyboard.on_press_key(config.GameKeys.primary_weapon,
                          lambda _: set_weapon_primary())
    keyboard.on_press_key(config.GameKeys.secondary_weapon,
                          lambda _: set_weapon_secondary())
    keyboard.on_press_key(config.GameKeys.sidearm,
                          lambda _: set_weapon_other())
    keyboard.on_press_key(config.GameKeys.throwables,
                          lambda _: set_weapon_other())
Exemple #9
0
mouse.hold('left')
# mouse.press('left')

# drag from (0, 0) to (100, 100) relatively with a duration of 0.1s
mouse.drag(0, 0, 100, 100, absolute=False, duration=0.1)

# whether a button is clicked
print(mouse.is_pressed('right'))

# move 100 right & 100 down
mouse.move(100, 100, absolute=False, duration=0.2)

# make a listener when left button is clicked
mouse.on_click(lambda: print("Left Button clicked."))
# make a listener when right button is clicked
mouse.on_right_click(lambda: print("Right Button clicked."))

# remove the listeners when you want
mouse.unhook_all()

# scroll down
mouse.wheel(-1)

# scroll up
mouse.wheel(1)

# record until you click right
events = mouse.record()

# replay these events
mouse.play(events[:-1])
Exemple #10
0
    check_config_key(CONFIG_KEY_DEFAULT_MOVE_CLICK)


def check_config_key(key_name):
    if CONFIG_DICT.get(key_name) is None \
            or CONFIG_DICT[key_name] == EMPTY:
        print("config.txtの{}の値が未設定です。".format(key_name))
        raise KeyError


def print_pos():
    while True:
        print("\r{:40}".format("Mouse position {}".format(mouse.get_position())), end="")
        time.sleep(0.1)


if __name__ == "__main__":
    is_after_pos_update = False
    load_config()
    jump_pos = (
        int(CONFIG_DICT[CONFIG_KEY_DEFAULT_MOVE_CLICK].split(",")[0]),
        int(CONFIG_DICT[CONFIG_KEY_DEFAULT_MOVE_CLICK].split(",")[1]))
    mouse.on_right_click(move_and_click)
    executor = concurrent.futures.ThreadPoolExecutor(max_workers=5)
    executor.submit(continue_left_click)
    executor.submit(update_pos)
    print("起動完了...")
    executor.submit(print_pos)
    while True:
        time.sleep(10)