Jump to content
Sign in to follow this  
gauss5546

Need help writing simple script

Recommended Posts

gauss5546

I haven't scripted for autoit in years and have forgotten most of what I knew. I'm trying to make a script that will start clicking left mouse when I hit 'space' and will keep clicking left mouse until I click 'space' again. Currently I have a script that will left click 100 times when I hit 'space' and I will post that here. It also has a tooltip that comes up by the mouse to say it is clicking. Any help would be appreciated. Thanks.

Global $Paused



HotKeySet ("{PAUSE}","pause")

HotKeySet ("{space}","one")

HotKeySet ("{ESC}","close")



AutoItSetOption ("MouseCoordMode",1)

while 1

four()

sleep(5000)

wend

Func click()

    $pos = MouseGetPos ()

    MouseClick ("left",$pos[0],$pos[1],100,1)

    two()

EndFunc



Func one()

While 1

    $pos = MouseGetPos ()

    ToolTip("Clicking",$pos[0] + 10,$pos[1] + 10)

    click()

WEnd

EndFunc



Func two()

While 1

    $pos = MouseGetPos ()

    ToolTip("Done",$pos[0] + 10,$pos[1] + 10)

    three()

WEnd

EndFunc



Func three()

While 1

    $pos = MouseGetPos ()

    ToolTip("Done",$pos[0] + 10,$pos[1] + 10)

    Sleep (100)

WEnd

EndFunc



Func four()

While 1

    Sleep (5000)

WEnd

EndFunc





Func pause()

    $Paused = NOT $Paused

    While $Paused

        sleep(100)

        ToolTip('Script is "Paused"',1063,822)

    WEnd

    ToolTip("")

EndFunc



Func close()

    Exit

    EndFunc

Share this post


Link to post
Share on other sites
JohnOne

This is very very basic but you're best learning how to do it yourself.

While...WEnd loop

MouseClick

Not

_IsPressed

Is all you need.

If you cannot be bothered, then just remove "two()" from current click() function should click forever.


AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

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  

×