input help #960
Replies: 1 comment
-
Welcome to the AutoKey community, @JacobTondreau ! Another AI trainwreck. AFAIK, no AI has bothered to scrape AutoKey and our wiki. Or at least that's what the results look like. Throw that "code" away and describe your script in English and write it in pseudocode if you are familiar with that and post it on Gitter. Then we'll try to help you build something that actually works. The more details you provide about what you want to do and what application window(s) it will be manipulating, the faster we can create a solution. If you're not sure how to do something, focus more on what the goal is and we can figure out the best way to accomplish it. If you do post any pseudocode or other structured text, be sure to prefix it with a blank line followed by a line that only contains three backticks on it and follow the text with a line that only contains three backticks on it followed by a blank line. This markdown turns the text into a blockquote which preserves any formatting, especially the white space like indentation, making it much more readable. (The backtick is the key to the left of the number one on a standard qwerty keyboard.) |
Beta Was this translation helpful? Give feedback.
-
This is my code and I keep getting variations of errors depending on what I change, im basically a noob when it comes to coding so ChatGPT got me here but it is not working how I want it to. The furthest I could get it was to press "h" click and then it sat there. (if you are curious this is supposed to be an auto place and upgrade script for a tower in bloonsTD6)
![fail](https://private-user-images.githubusercontent.com/159087162/382509263-b336e7d5-8d01-456b-ab99-8bf854fb2c8c.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3Mzk4MzQwNzcsIm5iZiI6MTczOTgzMzc3NywicGF0aCI6Ii8xNTkwODcxNjIvMzgyNTA5MjYzLWIzMzZlN2Q1LThkMDEtNDU2Yi1hYjk5LThiZjg1NGZiMmM4Yy5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjE3JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIxN1QyMzA5MzdaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT01NzYyODdhMWQ2ZDRlYjkwZDQ2ODc1ZTIyOGI4MzM3NDAwOTU3MzRmMGMwMzdhN2JlZTcwYTE4YzNlYzM4MDBiJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.RuNdaw3cwgL6dg01IEV73n5-vXDiiGLvhuJR7vMoC_o)
any help is welcome
import time
from pynput.keyboard import Controller as KeyboardController, Key
from pynput.mouse import Controller as MouseController, Button
Create keyboard and mouse controllers
keyboard = KeyboardController()
mouse = MouseController()
Step 1: Press the "h" key
keyboard.press('h')
keyboard.release('h')
time.sleep(0.1) # Small delay
Step 2: Click the left mouse button twice
mouse.click(Button.left, 1)
time.sleep(1) # Small delay
mouse.click(Button.left, 1)
time.sleep(1) # Small delay
Step 3: Press the "1" key on the numpad four times
for _ in range(4):
keyboard.press(Key.num_lock) # Ensure Num Lock is on
keyboard.release(Key.num_lock)
Step 4: Press the "2" key on the numpad two times
for _ in range(2):
keyboard.press(2)
keyboard.release(2)
time.sleep(0.2) # Delay between presses
Beta Was this translation helpful? Give feedback.
All reactions