Jump to content

loop script with a mouse click


Recommended Posts

what i am trying to do, somewhat unsuccesfully at this point is make a script loop with a right mouse click.

the script i wrote works great but i need it to do the samething lots of times and would like to be able to

click on a position anywhere on the screen and it will run once then click again anywhere and it runs again.

Link to comment
Share on other sites

Look for _IsPressed() function in the help file

I let you a little snippet. Next time post some script with what you already have done(Is much easily give some support that way).

#include <Misc.au3>                     ; UDF Where the function is.
Global $Text = 0                        ; some value to do the test.
Global $hDLL = DllOpen("user32.dll")    ; This is usefull if we gonna use _IsPressed a lot.
Global $check = False                   ; A variable to allow step in or out some loop.
While True
    If _IsPressed("01", $hDLL) Then     ; look the help for this one.
        Sleep(300)                      ; A usefull sleeptime to avoid the script recive multiclicking
        $check = Not $check             ;Change true to false or false to true.
    EndIf
    If $check Then                      ; If $check is true do something like enter in a loop
        While $check
            If _IsPressed("01", $hDLL) Then
                Sleep(300)
                ToolTip("")
                $check = Not $check
            EndIf
            $Text += 1                  ; Adds 1 to $Text
            ToolTip($Text)
            Sleep(100)                  ; A little sleep to avoid high CPU Usage
            ToolTip("")
        WEnd
    EndIf
    Sleep(100)                          ; A little sleep to avoid high CPU Usage
WEnd
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...