Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

(HELP)Send mouse clicks to multiple windows with same xy pos


  • Please log in to reply
1 reply to this topic
rhl958
  • Members
  • 1 posts
  • Last active: Dec 16 2008 04:18 PM
  • Joined: 16 Dec 2008
Hello

Am duelboxing wow on one computer I've found some scripts that got the job done with some tweaking. But I think it could be cleaned up to be just a few lines of code and handle mouse clicks more efficiently. So far what it does is gets the position (coords xy) of left mouse click from wowid1 and sends a key to wowid2 (idClone). This works prety good as long as I have assist macros setup for wowid2 and have the same keybounds setup.

Heres what I have

SplashTextOn, 325, , Preparing to find your Main and Clone windows of WoW.
Sleep, 1500
SplashTextOff

;Grab unique window ID
WinGet, wowid, List, World of Warcraft

; Minimize All WOW windows
WinMinimize, ahk_id %wowid1%
WinMinimize, ahk_id %wowid2%

;Determine Main and Clone Windows
WinActivate, ahk_id %wowid1%

MsgBox, 4,, Is this your WOW Main window? (press Yes or No)
IfMsgBox Yes
   idMain = %wowid1%
else
   idMain = %wowid2%

If idMain = %wowid1%
{
   idClone = %wowid2%
} else {
   idClone = %wowid1%
}

;Activate All WOW windows
WinActivate, ahk_id %idMain%
WinActivate, ahk_id %idClone%

; Left Mouse Button
#IfWinActive, World of Warcraft
~LButton::
{
; Action bar 1
If MouseInRange(184,219,709,742)
	ControlSend,, 1 , ahk_id %idClone%

else if MouseInRange(226,261,709,742)
	ControlSend,, 2 , ahk_id %idClone%

else if MouseInRange(268,303,709,742)
   	ControlSend,, 3 , ahk_id %idClone%

else if MouseInRange(310,345,709,742)
   	ControlSend,, 4 , ahk_id %idClone%  

else if MouseInRange(352,387,709,742)
   	ControlSend,, 5 , ahk_id %idClone%

else if MouseInRange(394,429,709,742)
   	ControlSend,, 6 , ahk_id %idClone%

else if MouseInRange(436,471,709,742)
   	ControlSend,, 7 , ahk_id %idClone%

else if MouseInRange(478,513,709,742)
   	ControlSend,, 8 , ahk_id %idClone%

else if MouseInRange(520,555,709,742)
   	ControlSend,, 9 , ahk_id %idClone%

else if MouseInRange(562,597,709,742)
   	ControlSend,, 0 , ahk_id %idClone%

else if MouseInRange(604,639,709,742)
   	ControlSend,, - , ahk_id %idClone%

else if MouseInRange(646,681,709,742)
   	ControlSend,, = , ahk_id %idClone%

; Left action bar
else if MouseInRange(184,219,660,692)
	ControlSend,, {shiftdown}{1}{shiftup} , ahk_id %idClone%

else if MouseInRange(226,261,660,692)
	ControlSend,, {shiftdown}{2}{shiftup} , ahk_id %idClone%

else if MouseInRange(268,303,660,692)
   	ControlSend,, {shiftdown}{3}{shiftup} , ahk_id %idClone%

else if MouseInRange(310,345,660,692)
   	ControlSend,, {shiftdown}{4}{shiftup} , ahk_id %idClone%  

else if MouseInRange(352,387,660,692)
   	ControlSend,, {shiftdown}{5}{shiftup} , ahk_id %idClone%

else if MouseInRange(394,429,660,692)
   	ControlSend,, {shiftdown}{6}{shiftup} , ahk_id %idClone%

else if MouseInRange(436,471,660,692)
   	ControlSend,, {shiftdown}{7}{shiftup} , ahk_id %idClone%

else if MouseInRange(478,513,660,692)
   	ControlSend,, {shiftdown}{8}{shiftup} , ahk_id %idClone%

else if MouseInRange(520,555,660,692)
   	ControlSend,, {shiftdown}{9}{shiftup} , ahk_id %idClone%

else if MouseInRange(562,597,660,692)
   	ControlSend,, {shiftdown}{0}{shiftup} , ahk_id %idClone%

else if MouseInRange(604,639,660,692)
   	ControlSend,, {shiftdown}{-}{shiftup} , ahk_id %idClone%

else if MouseInRange(646,681,660,692)
   	ControlSend,, {shiftdown}{=}{shiftup} , ahk_id %idClone%

; Right action bar
else if MouseInRange(694,729,660,692)
	ControlSend,, {Ctrldown}{1}{Ctrlup}, ahk_id %idClone%

else if MouseInRange(736,771,660,692)
	ControlSend,, {Ctrldown}{2}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(778,813,660,692)
   	ControlSend,, {Ctrldown}{3}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(820,855,660,692)
   	ControlSend,, {Ctrldown}{4}{Ctrlup} , ahk_id %idClone%  

else if MouseInRange(862,897,660,692)
   	ControlSend,, {Ctrldown}{5}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(904,939,660,692)
   	ControlSend,, {Ctrldown}{6}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(946,981,660,692)
   	ControlSend,, {Ctrldown}{7}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(988,1023,660,692)
   	ControlSend,, {Ctrldown}{8}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(1030,1065,660,692)
   	ControlSend,, {Ctrldown}{9}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(1072,1107,660,692)
   	ControlSend,, {Ctrldown}{0}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(1114,1149,660,692)
   	ControlSend,, {Ctrldown}{-}{Ctrlup} , ahk_id %idClone%

else if MouseInRange(1156,1191,660,692)
   	ControlSend,, {Ctrldown}{=}{Ctrlup} , ahk_id %idClone%

} 

return 

MouseInRange(minx,maxx,miny,maxy) 
{ 
MouseGetPos, x, y 
If (y >= miny) and (y <= maxy) and (x >= minx) and (x <= maxx) 
  Return 1 
Return 0 
}

Is there anyway to have it get the left mouseclick pos then have it send it to wowid2 something like (am no expert but here goes)

; Left Mouse Button
#IfWinActive, World of Warcraft
~LButton::
MouseGetPos, x, y
ControlSend "LEFT MOUSECLICK POS BLAH BLAH YOU GET THE IDEA"

So it prety much just sends the left mouse click to wowid2 in the same spot that it was clicked on in wowid1 can it be done.

Any help would be much appreciated

gps4213
  • Members
  • 22 posts
  • Last active: Dec 22 2009 03:50 PM
  • Joined: 30 Nov 2008
If what you are saying is you just want it to copy every left click at x/y location change the last line
; Left Mouse Button
#IfWinActive, World of Warcraft
~LButton::
MouseGetPos, x, y
ControlSend "LEFT MOUSECLICK POS BLAH BLAH YOU GET THE IDEA"

to
ControlClick, x%x% y%y%, ahk_id %idClone%,,L
Return

I have not tested this but according to the help file it should work.


Any one else with a better idea I would also be interested.