Automate mouse click in windows with script/batch file

前端 未结 3 692
执笔经年
执笔经年 2020-12-31 05:27

Firstly I\'d like to point out that this is a rather strange question and also that I don\'t even know if stackoverflow is right for this...

Anyways, is there a way

3条回答
  •  萌比男神i
    2020-12-31 05:52

    Just in case some poor soul stumbles upon this one day, using AutoIt that @rojo suggested above - This is the script that I wrote that accomplishes what I need:

    ; Initiate Script
    Main()
    
    Func Main()
        ; Infinite loop
        While 0 < 1
            If CheckTime() == true Then
                If CheckInternetConnection() == true Then
                    ; Internet Connection is true
                    ; So no worries
                Else
                    ; Internet Connection is false
                    ; Perform mouse click
                    MouseClick("left")
                EndIf       
            EndIf
            ; Sleep for 15 minutes
            Sleep(60000 * 15)
        WEnd
    EndFunc
    
    ; The function checks if the current time is between 00:00 and 05:00
    Func CheckTime()
        If @Hour >= 00 AND @Hour <= 05 Then
            Return true
        Else
            Return false
        EndIf
    EndFunc
    
    ; The function checks if currently is a internet connection
    Func CheckInternetConnection()
        Local $Connected = false
        $ping = Ping("www.google.com")
        If $ping > 0 Then
            $Connected = true
        EndIf
        Return $Connected
    EndFunc
    

    And there you go, just save the code in a file with a .au3 file extention, double click and enjoy.

提交回复
热议问题