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

前端 未结 5 1595
眼角桃花
眼角桃花 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:08

    To answer the actual question, in Perl, you would use the SendMouse (and the associated functions) provided by the Win32::GuiTest module.

    #!/usr/bin/perl
    
    use strict;
    use warnings;
    
    use Win32::GuiTest qw( MouseMoveAbsPix SendMouse );
    
    MouseMoveAbsPix(640,400);
    SendMouse "{LEFTCLICK}";
    
    __END__
    

    UPDATE:

    What if some virus scanning program pops up covering up the place where the click should happen?

    In that case, you would use FindWindowLike to find the window and MouseClick to send a click to that specific window.

提交回复
热议问题