#๐Ÿ”’ Make macro run out of focus on a certain window

4 messages ยท Page 1 of 1 (latest)

shut mango
#

Hi, im a begginer coder trying to make a macro perform on an application even while out of focus, how do you do this.

this is my code for the macro:
import random
import time
from pynput.keyboard import Key, Controller

keyboard = Controller()

time.sleep(3)
keyboard.press("w")
keyboard.press("a")
time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("d")
keyboard.press("a")

time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("d")
keyboard.press("a")

time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("d")
keyboard.press("a")

time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("d")
keyboard.press("a")

time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("d")
keyboard.press("a")

time.sleep(random.uniform(71.75,72))

keyboard.release("a")
keyboard.press("d")

time.sleep(random.uniform(71.75,72))

keyboard.release("w")
keyboard.press("]")
time.sleep(0.1)
keyboard.release("]")

white driftBOT
#

@shut mango

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

white driftBOT
#

@shut mango

Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.