The right click on the windows in the background works but not the left

Ask gaming related questions (AHK v1.1 and older)
Lulumi
Posts: 5
Joined: 08 Jun 2023, 02:56

The right click on the windows in the background works but not the left

Post by Lulumi » 08 Jun 2023, 03:02

Hello guys,
I don't understand why the left click does not work while the right does.
Maybe i'm wrong with this code...i try to keep the focus on a window game and execute the same action on others behind without change window.

Code: Select all

#SingleInstance Force
#Persistent
#NoEnv
SetBatchLines -1
DetectHiddenWindows, On

CoordMode, mouse, relative

WinGet, gamename, List, ahk_exe namegame.exe

#IfWinActive ahk_exe namegame.exe

!a::
MouseGetPos xpos, ypos

loop, %namegame%

{

Id := namegame%A_Index%

ControlClick, x%xpos% y%ypos%, ahk_id %Id%, , Left, 1



}

return
Thanks a lot for your help ! :)

[Mod edit: Wrong subforum: Moved topic to AHK v1 help, since this is not v2 related.]

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: The right click on the windows in the background works but not the left

Post by mikeyww » 08 Jun 2023, 05:34

Welcome to this AutoHotkey forum!

As far as I know, you cannot directly control whether the window becomes activated following the click, but you could try other coordinates or controls, or try making your primary window an on-top window (set to always on top).

Lulumi
Posts: 5
Joined: 08 Jun 2023, 02:56

Re: The right click on the windows in the background works but not the left

Post by Lulumi » 08 Jun 2023, 06:28

Thank you for your first answer, what I want to do is stay on my main window and when I click on a place X, all my background windows also do it in the same place

Lulumi
Posts: 5
Joined: 08 Jun 2023, 02:56

Re: The right click on the windows in the background works but not the left

Post by Lulumi » 08 Jun 2023, 07:09

@mikeyww
Thanks, I would simply like, while remaining on my main window, to do the same left click in the same place on the windows in the background without changing my main window

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: The right click on the windows in the background works but not the left

Post by mikeyww » 08 Jun 2023, 07:51

Your script provides an example of how the selection of variable names may be conducive to coding errors (bugs). I would have a look at whether your pseudoarray is called gamename or namegame.

Lulumi
Posts: 5
Joined: 08 Jun 2023, 02:56

Re: The right click on the windows in the background works but not the left

Post by Lulumi » 08 Jun 2023, 08:36

Gamename it's an exemple, but yes Gamename for all, i change with the name of my game

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: The right click on the windows in the background works but not the left

Post by mikeyww » 08 Jun 2023, 08:41

OK. I was merely pointing out the bug in your script, as you used the wrong name in your loop.

Lulumi
Posts: 5
Joined: 08 Jun 2023, 02:56

Re: The right click on the windows in the background works but not the left

Post by Lulumi » 08 Jun 2023, 11:59

So, any help? :P

User avatar
mikeyww
Posts: 26601
Joined: 09 Sep 2014, 18:38

Re: The right click on the windows in the background works but not the left

Post by mikeyww » 08 Jun 2023, 14:11

I would start with a bug fix, as you'll want the WinGet output variable to match your loop variable.

Post Reply

Return to “Gaming Help (v1)”