#๐Ÿ”’ cant find out whats bugged in my script

6 messages ยท Page 1 of 1 (latest)

topaz tendonBOT
#

@vernal marsh

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.

vernal marsh
#

my code is below

#

import pygetwindow as gw
import keyboard
import time
import pyautogui

def find_roblox_windows():
roblox_windows = [win for win in gw.getAllWindows() if "Roblox" in win.title and "Account Manager" not in win.title]
if not roblox_windows:
print("No Roblox windows found.")
return roblox_windows

def focus_roblox_windows(windows):
running = False
print("Press F2 to start or stop the focusing sequence.")

while True:
    if keyboard.is_pressed("F2"):
        running = not running
        if running:
            print("Focusing sequence started.")
        else:
            print("Focusing sequence stopped.")
        time.sleep(0.5)

    if running:
        for window in windows:
            if not running:
                break
            try:
                if window.isMinimized:
                    window.restore()
                time.sleep(0.5)

                window.activate()
                time.sleep(1)

                pyautogui.moveTo(window.left + 10, window.top + 10)
                time.sleep(0.5)

            except Exception as e:
                print(f"Error interacting with window '{window.title}': {e}")
                time.sleep(1)

def main():
windows = find_roblox_windows()
if not windows:
return

try:
    focus_roblox_windows(windows)
except KeyboardInterrupt:
    print("Script interrupted manually.")

if name == "main":
main()

topaz tendonBOT
#

@vernal marsh

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.

#

๐Ÿ”’ cant find out whats bugged in my script