Skip to content
Snippets Groups Projects
Commit 16e83a10 authored by Formanek Balázs István's avatar Formanek Balázs István
Browse files

sprint #1

parent f69019c2
Branches
No related tags found
No related merge requests found
import pyautogui
import keyboard
import time
# Function to move the mouse in the specified direction
def move_mouse(move_distance = 10, time_checking = 0.005, scroll_distance = 5):
while True:
if keyboard.is_pressed('W'):
pyautogui.move(0, -move_distance) # Move up
elif keyboard.is_pressed('S'):
pyautogui.move(0, move_distance) # Move down
elif keyboard.is_pressed('A'):
pyautogui.move(-move_distance, 0) # Move r
elif keyboard.is_pressed('D'):
pyautogui.move(move_distance, 0) # Move right
elif keyboard.is_pressed('L'):
pyautogui.click() # Left click
elif keyboard.is_pressed('R'):
pyautogui.click(button='right') # Right click
elif keyboard.is_pressed('up'):
pyautogui.scroll(scroll_distance) # Scroll upp
elif keyboard.is_pressed('down'):
pyautogui.scroll(-scroll_distance) # Scroll down
time.sleep(time_checking) # Adjust speed of movement
\ No newline at end of file
import pyautogui
import keyboard
import time
from move_mouse import move_mouse
from use_keyboard import press_button
# Start listening for key presses
if __name__ == "__main__":
print("Use the arrow keys to move the mouse. Press 'Esc' to exit.")
# Exit the program when 'Esc' is pressed
try:
while not keyboard.is_pressed('esc'):
press_button()
except:
print("Program terminated.")
\ No newline at end of file
import pyautogui
import keyboard
import time
# Function to move the mouse in the specified direction
def press_button(time_checking = 0.005):
shift_held = False
control_held = False
while not keyboard.is_pressed('esc'):
if keyboard.is_pressed('W'):
pyautogui.press('up')
elif keyboard.is_pressed('S'):
pyautogui.press('down') # Move down
elif keyboard.is_pressed('A'):
pyautogui.press('right') # Move r
elif keyboard.is_pressed('D'):
pyautogui.press('left') # Move right
elif keyboard.is_pressed('O'):
pyautogui.press('enter')
elif keyboard.is_pressed('P'):
pyautogui.press('space')
if keyboard.is_pressed('M'):
if not control_held:
pyautogui.keyDown('ctrl')
control_held = True
print("PRESSED CTRL")
elif keyboard.is_pressed('N'):
if control_held:
pyautogui.keyUp('ctrl')
control_held = False
print("released CTRL")
if keyboard.is_pressed('B'):
if not shift_held:
pyautogui.keyDown('shift')
shift_held = True
print("PRESSED shift")
elif keyboard.is_pressed('V'):
if shift_held:
pyautogui.keyUp('shift')
shift_held = False
print("released shift")
if keyboard.is_pressed('E'):
pyautogui.press('esc')
print("esc pressed")
time.sleep(time_checking) # Adjust speed of movement
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment