Jump to content

How to mouse clicks + coords


TehPwner
 Share

Recommended Posts

I am trying to get this script to click a specific coordinate and I was wondering how I could do it. This script, once F9 is hit, does an action every set seconds until F10 is hit, maximizing the window again and deactivating the script. I'm trying to get it to do something like ControlSend($handle, "", "", "{<mouse right click>}") <at so and so coordinate)

I tried searching and the results I found didn't help me much, any help would be appreciated and if I didn't explain myself properly sorry ^.^

HotKeySet("{F9}", "hide") 
HotKeySet("{F10}", "show") 
AutoItSetOption("WinTitleMatchMode", 4) 
While 1 
   Sleep(1000) 
WEnd 
 
Func hide() 
   Global $Show = 0 
   Global $handle = WinGetHandle("classname=GxWindowClassD3d") 
   WinSetState($handle, "", @SW_MINIMIZE) 
   WinSetState($handle, "", @SW_HIDE) 
   If @error Then 
      MsgBox(0, "error", "couldnt find Window") 
   Else 
      While 1 
         $unique = Random(1, 4, 1) 
         If $unique = 1 Then 
            ControlSend($handle, "", "", "{UP DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{UP UP}") 
        ControlSend($handle, "", "", "{2}") 
            ControlSend($handle, "", "", "{DOWN DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{DOWN UP}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 2 Then 
            ControlSend($handle, "", "", "{RIGHT DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{RIGHT UP}") 
        ControlSend($handle, "", "", "{2}") 
            ControlSend($handle, "", "", "{LEFT DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{LEFT UP}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 3 Then 
            ControlSend($handle, "", "", "{DOWN DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{DOWN UP}") 
        ControlSend($handle, "", "", "{2}") 
            ControlSend($handle, "", "", "{UP DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{UP UP}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         ElseIf $unique = 4 Then 
            ControlSend($handle, "", "", "{LEFT DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{LEFT UP}") 
        ControlSend($handle, "", "", "{2}") 
            ControlSend($handle, "", "", "{RIGHT DOWN}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(100 + Random(1, 50, 1)) 
            ControlSend($handle, "", "", "{RIGHT UP}") 
        ControlSend($handle, "", "", "{2}") 
            Sleep(200000 + Random(5000, 15000, 1)) 
         EndIf 
         If $Show > 0 Then ExitLoop 
      WEnd 
   EndIf 
EndFunc  ;==>hide 
 
Func show() 
   Global $Show = 1 
   WinSetState("World of Warcraft", "", @SW_SHOW) 
   WinSetState("World of Warcraft", "", @SW_MAXIMIZE) 
   WinActivate($handle, "") 
EndFunc  ;==>show
Link to comment
Share on other sites

Addition and bump

I figured out how to do the MouseClick now however

ControlSend($handle, "", "", MouseClick (("right"), x, y)

doesn't send to the program when it is inactive (i.e. it will right click my desktop and not send it), any suggestions?

Edited by TehPwner
Link to comment
Share on other sites

Thats what ControlSend is...if you just want to send to the active window its Send() but...using ControlSend...will send it the window you choose!

That's what I tried but it doesn't send it for some reason, only to the active window :|

I'll take a look at control click and see if that helps

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...