Using Perl, Python, or Ruby, how to write a program to “click” on the screen at scheduled time?

前端 未结 5 1561
眼角桃花
眼角桃花 2021-01-16 02:32

Using Perl, Python, or Ruby, can I write a program, probably calling Win32 API, to \"click\" on the screen at scheduled time, like every 1 hour?

Details:

5条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-16 03:13

    I find this is easier to approach in Java or C++. Java has a Robot class that allows you to just pass x, y coordinates and click somewhere. Using C++, you can achieve that same functionality using mouse_event() or SendMessage() with the WM_MOUSE_DOWN flag. SendMessage is more technical but it allows you to use FindWindow() and send mouse clicks to a specific window, even if it's minimized.

    Using a scripting language like Python or Ruby, I'd guess that you'd end up hooking into one of these Windows API functions anyway.

提交回复
热议问题