controlclick inactive window not working properly

Ask gaming related questions (AHK v1.1 and older)
zweex
Posts: 2
Joined: 06 Dec 2015, 16:30

controlclick inactive window not working properly

06 Dec 2015, 17:04

Hi,
oke so i'm trying to controlclick on a pop up window in dungeon defenders 2 while the game.exe is inactive.

this is the code i'm working with. (it also sends g. that works fine)

Code: Select all

SetTimer Click, 1000
wintitle = Dungeon Defenders 2
SetTitleMatchMode, 2
SetControlDelay -1
IfWinExist %wintitle% 

F2::Toggle := !Toggle

Click:
  If (!Toggle)
    Return
		Controlsend,,g, %wintitle% 
		ControlClick, x860 y700, %wintitle%
Return
F8:: ExitApp
when the scripts is running it doesnt click to popup button unless i hover over it.
but it does spam left click in the game
http://postimg.org/image/jjoz8myol/



if i use a code like this with the window active it works perfectly..

Code: Select all

SetTimer Click, 1000

F2::Toggle := !Toggle

Click:
  If (!Toggle)
    Return
	x = 860;
	y = 700;
		Click
		Send g
		MouseClick, left, x, y
Return
please help its driving me nuts.
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: controlclick inactive window not working properly

06 Dec 2015, 20:20

Try ControlFocus,, % WinTitle before ControlClick!?
AutoHotkey & AutoHotkey_H v1.1.22.07
zweex
Posts: 2
Joined: 06 Dec 2015, 16:30

Re: controlclick inactive window not working properly

07 Dec 2015, 06:14

do you mean like this?

Code: Select all

Click:
  If (!Toggle)
    Return
		Controlsend,,g, %wintitle% 
		ControlFocus, x860 y700, %wintitle%
		ControlClick, x860 y700, %wintitle%
Return
User avatar
Soft
Posts: 174
Joined: 07 Jan 2015, 13:18
Location: Seoul
Contact:

Re: controlclick inactive window not working properly

07 Dec 2015, 20:59

controlfocus,, % wintitle
AutoHotkey & AutoHotkey_H v1.1.22.07
User avatar
YoucefHam
Posts: 372
Joined: 24 Aug 2015, 12:56
Location: Algeria
Contact:

Re: controlclick inactive window not working properly

08 Dec 2015, 18:47

zweex wrote:do you mean like this?

Code: Select all

Click:
  If (!Toggle)
    Return
		Controlsend,,g, %wintitle% 
		ControlFocus, x860 y700, %wintitle%
		ControlClick, x860 y700, %wintitle%
Return
Hi, Try This, I didn't test it b.c I don't have the Game, Try it and tell me If there is a problem

Code: Select all

wintitle = Dungeon Defenders 2
SetTitleMatchMode, 2
SetControlDelay -1

#IfWinExist %wintitle%

F2::
Toggle := !Toggle
if Toggle
   SetTimer, Click, 1000
else
   SetTimer ,Click, Off
 
Click:
   ControlClick, x860 y700, %wintitle%
   Sleep, 40
Return

#IfWinExist
:wave: There is always more than one way to solve a problem. ;)

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 73 guests