Spamming space button in Overwatch Topic is solved

Ask gaming related questions (AHK v1.1 and older)
ChuckxxNorris
Posts: 7
Joined: 22 Mar 2017, 10:06

Spamming space button in Overwatch

22 Mar 2017, 10:20

Hello,

I am new at AHK and I don't get the programming language :/ .
Indeed I am able to write Java and C++ programms!

I want to do a script spamming the Space button with a delay of 16 ms, if you are holding the Space button AND Overwatch is opened...
I could be able to write one that's spamming, but I don't know how to check, if a programm is opened and how to check, if you are holding the button.

Would be awesome, if someone could help me :D

And do you know, if you can be banned by doing this? :lol:

Greetings
ChuckxxNorris
Posts: 7
Joined: 22 Mar 2017, 10:06

Re: Spamming space button in Overwatch

22 Mar 2017, 11:45

Now I ended up with this:

Code: Select all

F5::suspend

*space::
Process, Exist, Overwatch.exe ; check to see if Overwatch.exe is running
{
If ! errorLevel
{
IfExist, C:\Spiele\Battle.net\Overwatch\Overwatch.exe
Loop
{
GetKeyState,state,space,P
if state = U
break



Send,{space}
Sleep,8
}
}
else
{
Send,{space}
}
return
}
And it works perfectly fine, but I want the button to be spammed when caps is activ and when not to be normaly hold, if you understand what I mean :D

Help would be perfect!

Greetings
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Spamming space button in Overwatch  Topic is solved

22 Mar 2017, 13:05

You used IfExist, C:\Spiele\Battle.net\Overwatch\Overwatch.exe, but this would be true if Overwatch was installed, but not running or active, as it just checks for the existence of the Overwatch EXE on your disk.

There is a MUCH simpler way of doing this - "Context sensitive hotkeys"

Code: Select all

#if WinActive("ahk_exe Overwatch.exe") && GetKeyState("CapsLock", "T")
*space::
	; Put your hotkey code here
#if
In this way, your hotkey will only be active if the window is active and capslock is on
ChuckxxNorris
Posts: 7
Joined: 22 Mar 2017, 10:06

Re: Spamming space button in Overwatch

22 Mar 2017, 16:54

evilC wrote:You used IfExist, C:\Spiele\Battle.net\Overwatch\Overwatch.exe, but this would be true if Overwatch was installed, but not running or active, as it just checks for the existence of the Overwatch EXE on your disk.

There is a MUCH simpler way of doing this - "Context sensitive hotkeys"

Code: Select all

#if WinActive("ahk_exe Overwatch.exe") && GetKeyState("CapsLock", "T")
*space::
	; Put your hotkey code here
#if
In this way, your hotkey will only be active if the window is active and capslock is on
Thank you very much :)
User avatar
evilC
Posts: 4823
Joined: 27 Feb 2014, 12:30

Re: Spamming space button in Overwatch

22 Mar 2017, 17:23

By the way, as you are using *space::, you should probably prefix any Send commands with {Blind}: Send {Blind}{Space}
If you do not do this and are holding CTRL when you hit space, AHK will release CTRL, Send Space (Because you asked it to send Space, not CTRL+Space), then re-hold CTRL.

This is ESPECIALLY true if you are using CapsLock, else it may be like a disco in your bedroom ;)
ChuckxxNorris
Posts: 7
Joined: 22 Mar 2017, 10:06

Re: Spamming space button in Overwatch

24 Mar 2017, 08:07

evilC wrote:By the way, as you are using *space::, you should probably prefix any Send commands with {Blind}: Send {Blind}{Space}
If you do not do this and are holding CTRL when you hit space, AHK will release CTRL, Send Space (Because you asked it to send Space, not CTRL+Space), then re-hold CTRL.

This is ESPECIALLY true if you are using CapsLock, else it may be like a disco in your bedroom ;)
Thanks for the tip :) :thumbup:

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 75 guests