new version

This commit is contained in:
alex
2024-01-07 14:54:45 +01:00
parent acf3c69c90
commit 2d8e170047
4 changed files with 1889 additions and 38 deletions

25
moveing1.py Normal file
View File

@@ -0,0 +1,25 @@
import requests
import subprocess
import time
from PIL import Image, ImageGrab
import logging
def log_and_print(message):
print(message)
# Assuming you want to log to the same file as your main script
with open('minecraft_automation_log.txt', 'a') as log_file:
log_file.write(f'{time.strftime("%Y-%m-%d %H:%M:%S")}: {message}\n')
def hold_key_for_duration(key, duration):
log_and_print(f"Waiting 5 seconds before holding '{key}' key for {duration} seconds.")
time.sleep(5) # Delay for 5 seconds
log_and_print(f"Holding '{key}' key.")
subprocess.run(['xdotool', 'keydown', key])
time.sleep(duration)
subprocess.run(['xdotool', 'keyup', key])
log_and_print(f"Released '{key}' key.")
# Example usage
hold_key_for_duration('a', 11) # This will hold the 'a' key for 11 seconds