{"id":43,"date":"2026-04-24T14:38:42","date_gmt":"2026-04-24T14:38:42","guid":{"rendered":"https:\/\/theroyalscode.com\/students\/m_vicander\/?p=43"},"modified":"2026-04-24T14:38:42","modified_gmt":"2026-04-24T14:38:42","slug":"what-i-did","status":"publish","type":"post","link":"https:\/\/theroyalscode.com\/students\/m_vicander\/2026\/04\/24\/what-i-did\/","title":{"rendered":"what i did"},"content":{"rendered":"\n<p>what i did today was make an auto clicker that can turn on and off with a button<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>import time\nimport threading\nfrom pynput.mouse import Button, Controller\nfrom pynput.keyboard import Listener, KeyCode\n \n# Settings\nCLICK_DELAY = 0.01  # seconds between clicks\nSTART_STOP_KEY = KeyCode(char='s')\nEXIT_KEY = KeyCode(char='e')\n \nmouse = Controller()\nclicking = False\n \ndef click_loop():\n    \"\"\"Click while 'clicking' is True.\"\"\"\n    while True:\n        if clicking:\n            mouse.click(Button.left)\n            time.sleep(CLICK_DELAY)\n        else:\n            time.sleep(0.0001)\n \ndef on_press(key):\n    \"\"\"Handle key presses.\"\"\"\n    global clicking\n    if key == START_STOP_KEY:\n        clicking = not clicking\n        print(\"Clicking:\", clicking)\n    elif key == EXIT_KEY:\n        print(\"Exiting...\")\n        return False  # Stop listener\n \nif __name__ == \"__main__\":\n    print(\"Press 's' to start\/stop clicking, 'e' to exit.\")\n \n    # Start click loop in background\n    threading.Thread(target=click_loop, daemon=True).start()\n \n    # Listen for keyboard events\n    with Listener(on_press=on_press) as listener:\n        listener.join()\n <\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>what i did today was make an auto clicker that can turn on and off with a button<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-43","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/posts\/43","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/comments?post=43"}],"version-history":[{"count":1,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/posts\/43\/revisions"}],"predecessor-version":[{"id":44,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/posts\/43\/revisions\/44"}],"wp:attachment":[{"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/media?parent=43"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/categories?post=43"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/theroyalscode.com\/students\/m_vicander\/wp-json\/wp\/v2\/tags?post=43"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}