Control click NEVER works...

Ask gaming related questions
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Control click NEVER works...

23 Oct 2018, 15:51

i've been assisting many people with various game automation projects and all have fallen short when it comes to controlclick
i usually just shrug it off with "eh you'll work it out" but alas, my time has come
i begin writing my own multiboxing script which i hope to be an open source competitor for ISboxer, and as simple to set up as punch in your usernames in an INI file and run, out-of-box, i have window sizing, switching, and full keyboard replication (with any key combination), virtual files, handles for bringing ALL windows to the top when you bring one window to the top and vice versa, as if the whole boxing array is one window, but, as i feared
controlclick has failed, once again... and it's critical for this project...

i have scoured the forums...

https://autohotkey.com/board/topic/3567 ... me-xy-pos/
https://autohotkey.com/board/topic/1804 ... t-scripts/
https://autohotkey.com/board/topic/3629 ... ng-script/
https://autohotkey.com/boards/viewtopic.php?t=4850
https://autohotkey.com/board/topic/1087 ... ick-issue/
https://autohotkey.com/board/topic/1236 ... ordinates/
https://autohotkey.com/board/topic/9003 ... e-windows/
https://autohotkey.com/board/topic/8291 ... e-windows/
https://autohotkey.com/board/topic/1198 ... ox-script/
https://autohotkey.com/board/topic/4691 ... e-buttons/
https://autohotkey.com/board/topic/8363 ... ow-active/
https://autohotkey.com/board/topic/3277 ... trolclick/
https://autohotkey.com/board/topic/7423 ... ve-window/
https://autohotkey.com/board/topic/4520 ... -clicking/
https://autohotkey.com/board/topic/3897 ... esnt-work/
https://autohotkey.com/board/topic/9374 ... vating-it/
https://autohotkey.com/board/topic/84345-wow-click/
https://autohotkey.com/board/topic/8454 ... ined-spot/
https://autohotkey.com/board/topic/1173 ... -warcraft/
https://autohotkey.com/board/topic/8349 ... end-click/
https://autohotkey.com/board/topic/9695 ... k-improve/
https://autohotkey.com/board/topic/4375 ... stmessage/

I have tried solutions...

Code: Select all

wintitle := Acc[1, "AHK_ID"]
append("Clicking " x A_space y " in " wintitle)
ControlClick, x519 y504, AHK_ID %wintitle%wat
ControlClick, x519 y504, AHK_ID %wintitle%, Left
ControlClick,, AHK_ID %wintitle%,,L,2,NA x539 y499 
ControlClick,, AHK_ID %wintitle%,,L
ControlClick, x%x% y%y% , World of Warcraft
ControlClick, %x% %y%, ahk_id %wintitle%, , L, NA Pos
ControlClick, 517 505 , ahk_id %wintitle%, , L,2, NA Pos
ControlClick, x517 y505 , ahk_id %wintitle%, , L,2, NA Pos x539 y499
ControlClick, x517 y505 , ahk_id %wintitle%, , L,2, NA Pos x539 y499 D
sleep 100
ControlClick, x517 y505 , ahk_id %wintitle%, , L,2, NA Pos x539 y499 U
ControlClick, x517 y505 , ahk_id %wintitle%, , L
;0xA1
;0xA2
postclick(539, 499, wintitle)
postclick2(539, 499, wintitle)
postclick2(X, Y, wintitle)
ControlClick2(539, 499, wintitle)
ControlClick2(539, 499, "AHK_ID" wintitle)
return

;some of the funcs i'm using are below




PostClick(x,y,win="A") { ; assumes 'win' is the active window if no window title is specified

  lParam := x & 0xFFFF | (y & 0xFFFF) << 16
  PostMessage, 0x201, , % lParam, , % "AHK_ID" win ;WM_LBUTTONDOWN
  PostMessage, 0x202, , % lParam, , % "AHK_ID" win ;WM_LBUTTONUP
 
}
PostClick2(x,y,win="A")
	{ ; assumes 'win' is the active window if no window title is specified

		lParam := x & 0xFFFF | (y & 0xFFFF) << 16
		PostMessage, 0x200,			 0, % lParam	, , % "AHK_ID" win ; WM_MOUSEMOVE
		PostMessage, 0x21 ,	tohex(win), 0x00000001	, , % "AHK_ID" win ;MouseActivate
		PostMessage, 0x1C , 0x00000001, 0			, , % "AHK_ID" win ;Activate App
		PostMessage, 0x06 , 0x00000002, 0			, ,	% "AHK_ID" win ;Activate
		PostMessage, 0x20 , tohex(win), 0x02010001	, ,	% "AHK_ID" win ;SetCursor
		PostMessage, 0x201,			  , % lParam	, , % "AHK_ID" win ;WM_LBUTTONDOWN
		PostMessage, 0x202,			  , % lParam	, , % "AHK_ID" win ;WM_LBUTTONUP
}

ControlClick2(X, Y, WinTitle="", WinText="", ExcludeTitle="", ExcludeText="")
{
hwnd:=ControlFromPoint(X, Y, WinTitle, WinText, cX, cY
, ExcludeTitle, ExcludeText)
PostMessage, 0x200, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd% ; WM_MOUSEMOVE
PostMessage, 0x201, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd% ; WM_LBUTTONDOWN
PostMessage, 0x202, 0, cX&0xFFFF | cY<<16,, ahk_id %hwnd% ; WM_LBUTTONUP
}


yes, %wintitle% is correct, acc[1, "AHK_ID"] is correct as it is repeating keystrokes just fine using that very same var

i am yet to see controlclick work in anything other than Notepad
please, someone, tell me i'm doing something absolutely stupid ... SURELY AHK - auto hot key, the scripting language SPECIFICALLY DESIGNED FOR AUTOMATION is not failing at doing EXACTLY WHAT IT WAS DESIGNED TO DO...
</salt>

i have been at this for 2 days now so if someone would be so kind as to shed some light on this i would be very, very happy :p
Last edited by Bugz000 on 28 Oct 2018, 15:33, edited 1 time in total.
Image
swagfag
Posts: 1555
Joined: 11 Jan 2017, 17:59

Re: Control click NEVER works...

24 Oct 2018, 07:28

CoordMode doesnt do anything for ControlSend or Send/PostMessage, so im wondering how it fixed it. can u post the relevant snippet from the working script ure using, and tell me what ur wow window layout looks like?
i only have some oldoldoldold tbc client installed and all ControlClick can do is basically the actual clicking, ie if I run the game windowed fullscreen, then MouseMove over the spot id like to click without activating the wow window, the do a plain old hwnd ControlClick, the right spot will get clicked. I couldnt get ur "fix" to work. maybe its different on newer wows...
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

24 Oct 2018, 12:17

swagfag wrote:
24 Oct 2018, 07:28
CoordMode doesnt do anything for ControlSend or Send/PostMessage, so im wondering how it fixed it. can u post the relevant snippet from the working script ure using, and tell me what ur wow window layout looks like?
i only have some oldoldoldold tbc client installed and all ControlClick can do is basically the actual clicking, ie if I run the game windowed fullscreen, then MouseMove over the spot id like to click without activating the wow window, the do a plain old hwnd ControlClick, the right spot will get clicked. I couldnt get ur "fix" to work. maybe its different on newer wows...

ah i did some more checks etc, it now clicks fine but it clicks at the last coordinates the mouse was seen on the window, so i need to do some funky stuff i think to truly simulate mouse input, any ideas? :p
Image
swagfag
Posts: 1555
Joined: 11 Jan 2017, 17:59

Re: Control click NEVER works...

24 Oct 2018, 12:29

well thats what i was getting at. ControlClick will send the click, but it cant make it click on a given set of coordinates. The wow window remember its cursor position. U can hover the mouse quickly without activating the wow window by issuing an instant MouseMove command. Doing it this was will however preclude using window layouts, where u have one for example 1 window maximized and the rest of them minimized or placed behind the main window.
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: Control click NEVER works...

24 Oct 2018, 12:53

swagfag wrote:
24 Oct 2018, 12:29
well thats what i was getting at. ControlClick will send the click, but it cant make it click on a given set of coordinates.
Can you elaborate on this? The first parameter of ControlClick is 'Control-or-Pos' and takes an X Y coordinate.
swagfag
Posts: 1555
Joined: 11 Jan 2017, 17:59

Re: Control click NEVER works...

24 Oct 2018, 13:06

Ruevil2 wrote:
24 Oct 2018, 12:53
Can you elaborate on this? The first parameter of ControlClick is 'Control-or-Pos' and takes an X Y coordinate.
yes, but the coordinates are disregarded by the game.
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

24 Oct 2018, 17:40

tried it, doesn't work, it's in the URLs at the top if you look
Image
guest3456
Posts: 2468
Joined: 09 Oct 2013, 10:31

Re: Control click NEVER works...

24 Oct 2018, 19:09

Bugz000 wrote:
24 Oct 2018, 17:40
tried it, doesn't work, it's in the URLs at the top if you look
youre missing the ControlFromPoint() func

AHK's ControlClick simply wraps the WM_LBUTTONDOWN messages. it works in many other apps besides just notepad. i use it successfully often. however, some games simply don't respond to those messages, and you have to use a regular Click instead. it sucks but its up to the game to respond to those messages or not.

Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: Control click NEVER works...

25 Oct 2018, 10:07

swagfag wrote:
24 Oct 2018, 13:06
Ruevil2 wrote:
24 Oct 2018, 12:53
Can you elaborate on this? The first parameter of ControlClick is 'Control-or-Pos' and takes an X Y coordinate.
yes, but the coordinates are disregarded by the game.
Thank you. I just assumed that you meant there was some issue with AHK rather than an issue with the game itself.
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

27 Oct 2018, 20:56

so i did some more research, turns out my "fix" was a fluke, mouse clicks on last known position on the WoW window, so i need to emulate a mouse move on the WoW window - without throwing my mouse around like ... something that moves rapidly
Image
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

28 Oct 2018, 15:35

Image

here's my window layout, all windows are visible (Some coord errors so 3 boxes are offscreen on the right but i've been testing on one WoW window anyway)

WOTLK 3.3.5a


it outputs colored HTML log too [nsfw]
https://pastebin.com/rLM4DRe4 save contents as HTML, open in chrome

but cannot for the life of me work out clicks to background WoW windows, i know it's possible, ISboxer does it...
Image
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: Control click NEVER works...

31 Oct 2018, 09:07

Check this post..

It seems that this guy managed to get some ControlClick commands to work with a WoW client. It might be that this client is just different enough to cause problems but I haven't played WoW in a long time so I can't be sure.

He mentions that he has it working for a few hours. It looks like he is using some of the same things that you tried already but I think it's worth a try!

https://autohotkey.com/boards/viewtopic ... 2&start=20
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

31 Oct 2018, 14:27

reading this he only got keyboard input to work, keyboard input works absolutely flawlessly so no help there

also the post explains polling methods for DX programs, WoW does not poll inputs

it infact as with many games nowadays (basically all of them), it buffers them at a very low level and runs through as many inputs as it can each frame
How ISboxer does it is it pushes new events into this input stack and lets WoW process them when it's ready rather than actually trying to duplicate the mouse (which is impossible)

at this point i'm lost, i don't know where to look, two multiboxing softwares managed to do this successfully so it is possible, but i don't know where to start my research

i'd even go as far as to have a second C++ or C# program running listening for sendevents from main AHK program to prompt it to push events in at the low level but as i say, where do i look for information on how to do this lol :/

this project will be open source and the input stack tool released will be a "fix" for masses of people looking to hook AHK into games correctly as controlclick just does not work as people expect, and i highly doubt AHK has the low level access to be able to do it either so...
best thing is another EXE and sendevent or something

any ideas?

edit: research!

https://stackoverflow.com/questions/863 ... nput-queue
>input can be redirected to a different thread's message queue using the AttachThreadInput
Image
Ruevil2
Posts: 153
Joined: 14 Jul 2014, 10:39

Re: Control click NEVER works...

01 Nov 2018, 07:36

Bugz000 wrote:
31 Oct 2018, 14:27
edit: research!

https://stackoverflow.com/questions/863 ... nput-queue
>input can be redirected to a different thread's message queue using the AttachThreadInput
I think you are on to something there, do you think that WoW only reads from a particular stack? I read through it and it seemed like you could return a pointer to either the raw or synthesized input stacks and work with them directly. Personally that's where I start to get foggy, I am not very good with the raw memory gets and sets. I have found very rare occasion to have to resort to that low level before.
User avatar
Bugz000
Posts: 38
Joined: 30 Sep 2013, 10:01

Re: Control click NEVER works...

16 Nov 2018, 19:24

Ruevil2 wrote:
01 Nov 2018, 07:36
Bugz000 wrote:
31 Oct 2018, 14:27
edit: research!

https://stackoverflow.com/questions/863 ... nput-queue
>input can be redirected to a different thread's message queue using the AttachThreadInput
I think you are on to something there, do you think that WoW only reads from a particular stack? I read through it and it seemed like you could return a pointer to either the raw or synthesized input stacks and work with them directly. Personally that's where I start to get foggy, I am not very good with the raw memory gets and sets. I have found very rare occasion to have to resort to that low level before.

that's really interesting actually, how do you figure getting pointers? it definitely seems like something that would work :o

LOLdurp.

"GetMessage() processes them separately.

THREADINFO contains a pointer directly to the post message list/queue. This is scanned if QS_POSTMESSAGE is set."
Image

Return to “Gaming”

Who is online

Users browsing this forum: No registered users and 13 guests