I need 2 scripts please: autoclickers

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

I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 15:57

Hello to everyone i'm in real need of two autohotkeys and I can't do them by myself!
- 1st one I need is pressing "mouse left click" and then 1 second delay and press "SPACE" then 2 second delay and "repeat"
- 2nd one is pressing "E" every 5 seconds
this both autoclickers i need them in a specific window which is fiveM so I can use my pc

Thanks in advance!

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 23 May 2022, 16:10

Code: Select all

F2::SetTimer, F2 Up, % (f2 := !f2) ? 5000 : "Off"
F2 Up::Send % f2 ? "e" : ""

F3::SetTimer, F3 Up, % (f3 := !f3) ? 3000 : "Off"
F3 Up::
Click
Sleep, 990
Send {Space}
Sleep, 1990
Return

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 20:23

thank you it works pretty well but to be perfect I need it to work while game is running in background, window spy shows this: https://prnt.sc/s0cwfe4_L6Vq

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 23 May 2022, 20:37

You can always try :arrow: ControlSend and ControlClick. They sometimes work. viewtopic.php?f=7&t=11084 • Good luck. Example

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:11

my head is burning ahah I can't get it to work

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 23 May 2022, 21:13

If you test it in Notepad first, you will know if your commands are OK. ControlSend works in Notepad.

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:27

have it like this but nothing works https://prnt.sc/Bwq_6vDVh37O

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:28

this is my first time using stuff like this sorry

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 23 May 2022, 21:31

Test in Notepad first. Try the example from the documentation, to see if that works first. After it does, you can see if your own text works in Notepad. After it does, you can see if your own text works in your target program. The iterative approach may seem slower than what you tried, but it's actually faster because you are testing one step at a time. When you reach a failure point, you know where to troubleshoot instead of being puzzled about where to look.

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:34

ok i've tried the example 1 and nothing happened

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 23 May 2022, 21:39

Now we are getting somewhere, because you indicated that the following script, by itself, does nothing when you run it.

Code: Select all

Run, Notepad,, Min, PID  ; Run Notepad minimized.
WinWait, ahk_pid %PID%  ; Wait for it to appear.
ControlSend, Edit1, This is a line of text in the notepad window.{Enter}
ControlSendRaw, Edit1, Notice that {Enter} is not sent as an Enter keystroke with ControlSendRaw.
MsgBox, Press OK to activate the window to see the result.
WinActivate, ahk_pid %PID%  ; Show the result.
Considering this, I am not sure why this would be true. Are you sure that you ran the script? Did Notepad run, and open a Notepad window? Was the window minimized? It's really hard to believe that nothing happened, so some details would be useful here. What version of AHK are you using?

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:45

ok so 1st i simply copy pasted this into notepad++:

Run, Notepad,, Min, PID ; Run Notepad minimized.
WinWait, ahk_pid %PID% ; Wait for it to appear.
ControlSend, Edit1, This is a line of text in the notepad window.{Enter}
ControlSendRaw, Edit1, Notice that {Enter} is not sent as an Enter keystroke with ControlSendRaw.
MsgBox, Press OK to activate the window to see the result.
WinActivate, ahk_pid %PID% ; Show the result.

then i executed it and nothing happened the game is in windowed mode but not minimized my ahk version is 1.1.33.10

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 21:53

im really trying but my head is almost blowing off xD maybe I will forget this idea i just need the AHK to work while game is running on background wich I thought was the easy part but I see it is really hard I have learned many posts here in the forum but I'm portuguese and my english is very basic so this is very hard to me

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 23 May 2022, 22:08

so the script you sent me first works but everytime I put ControlSend the code stop working game even if the game is focused

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

Re: I need 2 scripts please: autoclickers

Post by mikeyww » 24 May 2022, 06:09

Some windows do not respond to ControlSend. I would try the tips for games that I posted. That's about all I know! Best of luck.

If you need more input, post the newer script that you are trying to get to work. Other readers may have additional suggestions for you when they see it.

If the script that I posted does not run Notepad, then you are doing something wrong, but I'm not sure what that is.

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 24 May 2022, 07:14

ok so controlsend works in notepad

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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 24 May 2022, 08:29

what's next?


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

Re: I need 2 scripts please: autoclickers

Post by RapaCanelas » 24 May 2022, 09:09

got it to work but everytime the button specified on script is pressed game changes to 1st plan now I have it like this

Code: Select all

F7::SetTimer, F7 Up, % (f7 := !f7) ? 5000 : "Off"
F7 Up::
WinWait, ahk_pid 14804
WinActivate, ahk_exe FiveM_b2545_GTAProcess.exe
ControlSend, , {E Down}
Sleep 199
ControlSend, , {E Up}
Return

Post Reply

Return to “Gaming Help (v1)”