Jump to content

Recommended Posts

Posted

Good evening!

I presume that the following question may seem simple to most of you, for I am new to AutoIt and am but an unexperienced explorer of its features, but I also hope to receive some help.

The first code I ever wrote in AutoIt was something like this:

HotKeySet("{F7}","a")
Global $1 = 0
Func a()
    If $1 = 0 Then
        $1 = 1
    Else
        $1 = 0
    EndIf
EndFunc
While 1
    If $1 = 1 Then
        MouseClick("right")
    EndIf
    Sleep(100)
WEnd

It worked as a simple "auto clicker" for me, activated and deactivated by the button F7. However, now I am trying to make it activate by clicking my right mouse button. So that by clicking the right button once, the script must continue to right-click until stopped in the same manner.

The problem is that am unable to bind any of my mouse-buttons to the function "a", like I did with F7 in the attached code. Is it at all possible to use mouse-buttons as "HotKeys"?

Thanks for any coming answers!

Posted

Well, you could START the program by doing something like this:

While 1
    $Start = _IsPressed(02)
    If $Start = 1 Then a()
    Sleep(25)
WEnd

But that's going to eat resources and you can't stop it by a right click, because otherwise your script would ALWAYS run only once. Because the AutoIt right click would cancel the script as well.

-Fett

[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]

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
  • Recently Browsing   0 members

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