Jump to content
Sign in to follow this  

MouseClick Help (again XD)

Recommended Posts


Over the past 3 days, I've been working on a program that will automate tasks/actions you do on your computer for you. I'm relatively new at AutoIt, so bare with me. Right now I have a code that's suppose to record a mouse click you do when you press the Tab key and stop recording when you press it again, then repeat the click when you press the Enter key. For some reason it's not working. Could someone help me figure out what's wrong with the code?

#include <Array.au3>
#include <Misc.au3>

Dim $Position, $i = 0, $Record[1]
$score = 0
While 1
    If _IsPressed("09") Then
        $score = 1
    If $score = 1 Then
        If _IsPressed("01") Then
            $Position = MouseGetPos()
            $x = $Position[0]
            $y = $position[1]
            ReDim $Record[$i + 2]
            $Record[$i] = $x
            $Record[$i + 1] = $y
            $i += 2

    If $score = 0 Then
        If _IsPressed("0D") Then
            MouseClick("left", $x, $y, 1)

[font="Comic Sans MS"]BA-LA[/font]http://ba-la.110mb.comJoin my community, CLICK HEREAlternative links to my site:http://www.ba-la.tkhttp://www.ba-la.co.nrContact me if you would like to help with some of my projects: joeythepirate@gmail.com

Share this post

Link to post
Share on other sites

To set your script to do things on a key press, use hotkeys. Straight out of the helpfile:

; Press Esc to terminate script, Pause/Break to "pause"

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")
HotKeySet("+!d", "ShowMessage")  ;Shift-Alt-d

;;;; Body of program would go here ;;;;
While 1

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        ToolTip('Script is "Paused"',0,0)

Func Terminate()
    Exit 0

Func ShowMessage()
    MsgBox(4096,"","This is a message.")

IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]

Share this post

Link to post
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
Sign in to follow this  


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.