Sign in to follow this  
Followers 0
mdude186

quick question...

7 posts in this topic

i was wondering what the script would be if i wanted to have my mouse move to a position and click when i click a button. all i have right now is..

HotKeySet("1", "Main")

Func Main()

If _IsPressed(31) Then ; If 1 key is pressed

MouseMove(732, 691)

MouseDown("left")

MouseUp("left")

EndIf

_IsPressed(60)

EndFunc

this does not work....my ideal situation would be if i press the s key the mouse moves to (732, 691) and clicks. And then the script ends when i push the d key.

Thank you,

mdude186

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

I am not sure about how you want to trigger and stop, try something like this:

#Include <Misc.au3>

HotKeySet("1", "Main") 

While 1
    Sleep(100)
WEnd

Func Main() 
    Do
        MouseClick("left",200,200)
        Sleep(1000)
    Until _IsPressed("60")
EndFunc

When you press 1 it will start clicking every second until key with code 60 (numpad 0 according to help file) is pressed (it must get to checking for it after that 1s pause).

Edited by Rarst

Share this post


Link to post
Share on other sites

Well...the mouse moves lol. But when i try to take it away from that spot it goes right back without me doing anything. It took a bit of effort to shut the script off lol...What i'm specifically looking for is. When i push the s key the mouse will click on that spot. Thats all. And i can do that over and over with out the script shutting off. but after i hit the s key it clicks and stops so i can move the mouse freely again.

Share this post


Link to post
Share on other sites

Well it works! Thank for your help. But i was wondering one more thing. Is there a way to make it so the mouse moves and clicks almost instantly? so in other words a way to change the speed to go very fast.

Thank you again,

mdude

Share this post


Link to post
Share on other sites

Oh well thank you all very much!! It is greatly appreciated.

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  
Followers 0