Jump to content

Mouse Clicks Repeat


 Share

Recommended Posts

Ok so i have this so far

#include <GUIConstantsEx.au3>

;Opt('MustDeclareVars', 1)
Opt("GUICoordMode", 2)

HotKeySet("^!x", "MyExit")

; Prompt the user to run the script - use a Yes/No prompt (4 - see help file)
$answer = MsgBox(4, "Verification For DCS Anti Idle", "Please enter the password!")


; Check the user's answer to the prompt (see the help file for MsgBox return values)
; If "No" was clicked (7) then exit the script
If $answer = 7 Then
    MsgBox(4096, "Dragon", "OK.  Bye!")
    Exit
EndIf



; Loop around until the user gives a valid "autoit" answer
$bLoop = 1
While $bLoop = 1
    $text = InputBox("Verification For DCS Anti Idle", "Plase enter the password!")
    If @error = 1 Then
        MsgBox(4096, "Error", "You pressed 'Cancel' - try again!")
    Else
        ; They clicked OK, but did they type the right thing?
        If $text <> "Dragon" Then
            MsgBox(4096, "Error", "You typed in the wrong password - try again!")
        Else

            If Not WinExists("[CLASS:Second Life]") Then
                MsgBox(0, "", "Please make sure you have Second Life open before starting the program!")
            Else
                Example()
            EndIf
        EndIf
    EndIf
WEnd



Func Example()
    Local $Button_1, $Button_2, $msg
    GUICreate("DCS2 Anti-Idle", "250", "75")


    $Button_1 = GUICtrlCreateButton("Start Anti-Idle", 10, 30, 100)
    $Button_2 = GUICtrlCreateButton("End Anti-Idle", 0, -1)

    GUISetState() ; will display an  dialog box with 2 button

    ; Run the GUI until the dialog is closed
    While 1
        $msg = GUIGetMsg()
        Select
            Case $msg = $GUI_EVENT_CLOSE
                Exit
            Case $msg = $Button_1
                $bLoop = 5
                ControlFocus("[CLASS:Second Life]", "", "")
                GUICtrlSetState($Button_1, $GUI_DISABLE)
                Sleep(2000)
                MouseClick("left", 647, 213, 1)
                Sleep(3000)
                MouseClick("left", 660, 213, 1)
                Sleep(3000)
                GUICtrlSetState($Button_1, $GUI_ENABLE)
            Case $msg = $Button_2
                Exit
        EndSelect
    WEnd
EndFunc   ;==>Example

Func MyExit()
    Exit
EndFunc   ;==>MyExit

Where the mouseclick's are i want them to repeat forever until Case $msg = $Button_2

2 problems

1) It will not loop

2) When Case $msg = $Button_2 is used it will not exit

Any help would be great!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...