Advertisement
ZirconC

Testings

Aug 22nd, 2023
844
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.25 KB | None | 0 0
  1. import webbrowser
  2. import pyautogui
  3. import time
  4.  
  5. def open_website(website_url):
  6.     # ให้บอทคลิกลิงก์
  7.     webbrowser.open(website_url)
  8.  
  9. def create_automatic_link(link_text):
  10.     return f"<a href='#'>{link_text}</a>"
  11.  
  12. def click_auto_link():
  13.     # คลิกที่ตำแหน่งบนหน้าจอ
  14.     pyautogui.click(x=500, y=500)
  15.     time.sleep(2)  # รอสักครู่เพื่อให้หน้าเว็บโหลด
  16.  
  17. def main():
  18.     while True:
  19.         # ลิงก์เว็บไซต์ที่ต้องการให้บอทคลิก
  20.         website_url = "https://www.dragon.com"
  21.  
  22.         # ให้บอทเปิดเว็บไซต์ dragon.com
  23.         open_website(website_url)
  24.  
  25.         # ลิงก์ "ทำให้มันกด เลือกซื้อของอัตโนมัติโดยใช้ ตำแหน่งเมาส์ เป็นพิกัด"
  26.         automatic_link = create_automatic_link("ทำให้มันกด เลือกซื้อของอัตโนมัติโดยใช้ ตำแหน่งเมาส์ เป็นพิกัด")
  27.        
  28.         # แสดงผลตอบคำถามของบอท
  29.         print(f"Bot: คุณสามารถ{automatic_link}.")
  30.  
  31.         # รอผู้ใช้คลิกเพื่อทำการซื้อของอัตโนมัติ
  32.         input("Bot: คลิกที่ตำแหน่งเพื่อทำการซื้อของอัตโนมัติ... (กด Enter เมื่อคลิกเสร็จ)")
  33.  
  34.         # บอทจะคลิกที่ตำแหน่งเมาส์ที่กำหนด
  35.         click_auto_link()
  36.  
  37.         # ถามผู้ใช้ว่าต้องการดำเนินการต่อหรือไม่
  38.         user_input = input("Bot: คุณต้องการทำรายการต่อหรือไม่? (y/n): ")
  39.        
  40.         if user_input.lower() != 'y':
  41.             print("Bot: บอทจะหยุดทำงาน")
  42.             break
  43.  
  44. if __name__ == "__main__":
  45.     main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement