Created
April 5, 2024 00:57
-
-
Save htlin222/bd234cf92bcee8cd02a431a541b6de23 to your computer and use it in GitHub Desktop.
自動點擊的魔法
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# -*- coding: utf-8 -*- | |
# title: auto click on my screen | |
# author: Hsieh-Ting Lin, the Lizard 🦎 | |
# description: 自動點擊的魔法 | |
# date: "2024-04-05" | |
# --END-- # | |
import time | |
import pyautogui | |
# Black Apple | |
# pos_x = 759 | |
# pos_y = 1778 | |
# MBP Air | |
pos_x = 717 | |
pos_y = 613 | |
def get_cursor_pos(): | |
while True: | |
x, y = pyautogui.position() | |
print(f"Current cursor position: x={x} y={y}") | |
time.sleep(1) | |
def click(x, y, n): | |
for i in range(n): | |
time.sleep(1800) | |
pyautogui.moveTo(x, y) | |
pyautogui.click() | |
time.sleep(2) | |
print("Now Click Yes") | |
pyautogui.click() | |
if __name__ == "__main__": | |
# get_cursor_pos() | |
click(pos_x, pos_y, 2) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment