Need help making this script work on background

Ask gaming related questions (AHK v1.1 and older)
RapaCanelas
Posts: 15
Joined: 23 May 2022, 15:54

Need help making this script work on background

Post by RapaCanelas » 24 May 2022, 06:45

Hello! Yesterday I've posted a topic asking for a script and a very friendly man helped me but now I need to make the script run in background and this step i can't get to work, my english is very bad and this is my first time messing with ahk so it's been really hard to me I've tryied everything I saw in this forum I spent like 3 hours to make it work but without success so if anyone whants to help me out or even make the coding for me I would be very very gratefull!

The ahk file is:

Code: Select all

F3::SetTimer, F3 Up, % (f3 := !f3) ? 3000 : "Off"
F3 Up::
Click
Sleep, 990
Send {Space}
Sleep, 1990
Return
The windowspy info for the gamewindow I whant to send the ahk is:

FiveM® by Cfx.re - Future RP | Drogas, Putas e Vinho Verde
ahk_class grcWindow
ahk_exe FiveM_b2545_GTAProcess.exe
ahk_pid 14232

Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help making this script work on background

Post by Rohwedder » 24 May 2022, 09:54

Hallo,
try:

Code: Select all

F3::SetTimer, grcWindow, % (f3 := !f3) ? 3000 : "Off"
grcWindow:
ControlClick,, ahk_class grcWindow
Sleep, 990
ControlSend,, {Space Down}, ahk_class grcWindows
Sleep, 100
ControlSend,, {Space Up}, ahk_class grcWindow
Return
But many games want to receive Autohotkey messages only when their window is active.

RapaCanelas
Posts: 15
Joined: 23 May 2022, 15:54

Re: Need help making this script work on background

Post by RapaCanelas » 24 May 2022, 14:04

I had to change the script to this:

Code: Select all

F3::SetTimer, FiveM_b2545_GTAProcess.exe, % (f3 := !f3) ? 3000 : "Off"
FiveM_b2545_GTAProcess.exe:
ControlClick,, ahk_exe FiveM_b2545_GTAProcess.exe
Sleep, 990
ControlSend,, {Space Down}, ahk_exe FiveM_b2545_GTAProcess.exe
Sleep, 100
ControlSend,, {Space Up}, ahk_exe FiveM_b2545_GTAProcess.exe
Return
[Mod edit: [code][/code] tags added.]

Now it is working except controlclick

Rohwedder
Posts: 7623
Joined: 04 Jun 2014, 08:33
Location: Germany

Re: Need help making this script work on background

Post by Rohwedder » 24 May 2022, 23:27

Then try with ClassNN: https://www.autohotkey.com/docs/commands/ControlClick.htm#Parameters
To determine ClassNN turn on "Follow Mouse" in the upper right corner of Window Spy.

RapaCanelas
Posts: 15
Joined: 23 May 2022, 15:54

Re: Need help making this script work on background

Post by RapaCanelas » 25 May 2022, 07:21

I've tried it now but when my mouse is on the game no ClassNN is shown

Post Reply

Return to “Gaming Help (v1)”