World Of Warcraft Press once A Hotkey And Spam it Topic is solved

Ask gaming related questions (AHK v1.1 and older)
ali_tx
Posts: 12
Joined: 11 Mar 2021, 06:33

World Of Warcraft Press once A Hotkey And Spam it

11 Mar 2021, 07:11

Hi there guys. I'm new to AHK im looking for a script by pressing a hotkey once and realse it then it start to spam that hotkey .
I want to make it for binds like 1-9 And q,w,e,r,t,y,u,a,s,d,f,g,z,x,c,v or i don't mind if it work on all keybidings if it's easier to make it for all keys
I would also like to turn it on and off with one button like P
thank you for your help and time good luck.
User avatar
Grendahl
Posts: 170
Joined: 30 Sep 2013, 08:21

Re: World Of Warcraft Press once A Hotkey And Spam it

11 Mar 2021, 08:54

ali_tx wrote:
11 Mar 2021, 07:11
Hi there guys. I'm new to AHK im looking for a script by pressing a hotkey once and realse it then it start to spam that hotkey .
I want to make it for binds like 1-9 And q,w,e,r,t,y,u,a,s,d,f,g,z,x,c,v or i don't mind if it work on all keybidings if it's easier to make it for all keys
I would also like to turn it on and off with one button like P
thank you for your help and time good luck.

Code: Select all

; AutoHotkey Version: 1.1_L
; Language:       English
; Platform:       Win 64bit
; Author:         Grendahl

#NoEnv
#SingleInstance Force
SetWorkingDir %A_ScriptDir% 
SetTitleMatchMode, 2
SetBatchLines, -1

ReadMeFile = %A_ScriptDir%\SimpleSpam_ReadMe.txt
IfNotExist, %ReadMeFile%
{
	FileAppend,
(
Script Function:
	Repeatedly presses keys (including modifiers) while they are held down, at the rate specified.
	F12 is reserved to toggle the script state between suspended and running. Useful when you want to chat or /roll.
	CTRL-ALT-ESC quits the script.

	Set Keys to spam and Delay in SimpleSpam.ini
	Format for the settings is KeysAndDelay=key1,key2,key(n)|delay in ms (1000ms is 1second)
	Example:
	KeysAndDelay=1,2,3,4,F1,F2,F3,F4,-|50
	The above line would spam keys 1, 2, 3, 4, F1, F2, F3, F4 and - while they are held down,
	at the rate of 1 keypress every 50 milliseconds.
	If you don't configure anything, by default this script will spam 1, 2, 3, 4, F1, F2, F3, F4, and F4 @ 50ms
		
	You need to re-run this script after saving changes to SimpleSpam.ini so it can read the new settings.
), %ReadMeFile%
	Run, %ReadMeFile%
}

;Set and read settings file
SettingsFile = %A_ScriptDir%\SimpleSpam.ini
IfNotExist,%SettingsFile% ;If there's no settings file yet, create it and put in some example data
{
	FileAppend, [Settings]`nKeysAndDelay=1`,2`,3`,4`,F1`,F2`,F3`,F4|50`n,%SettingsFile% 
}
IniRead, IniKeysAndDelay, %SettingsFile%, Settings, KeysAndDelay ;get the list of keys|delay 
SpamSettings := StrSplit(IniKeysAndDelay,"|")

;Build the array of keys to spam and set the delay
key_list := []
key_list := StrSplit(SpamSettings[1],",")
Delay := SpamSettings[2]


OSD("SimpleSpam`nRunning`nF12 to Pause`nCtrl-Alt-Esc to Quit","Lime",30,5) ; Notify user that the script is running

#IfWinActive, World of Warcraft ; only if wow is active

keys := [] ;Build lookup array, declare hotkeys
Loop % key_list.MaxIndex()
{
	key := key_list[A_Index]
	keys[key] := 0 ; init array values
	hotkey, $*%key%, keydown ; Declare hotkeys for up and down events
	hotkey, $*%key% up, keyup
}

Loop { 
	for sendkey, value in keys { ; Loop through each of the keys in key_list
		if (value){
			Send, {blind}{%sendkey%}
		}
	}
	Sleep %Delay%
}
return ;End of autoexecute section

; Keys are pressed
keydown:
	key := SubStr(A_ThisHotkey,3)
	keys[key] := 1
return

; Keys are released
keyup:
	key := SubStr(A_ThisHotkey,3)
	key := substr(key, 1, StrLen(key) - 3)
	keys[key] := 0
return

!^$Esc:: ; Quit script on CTRL-ALT-ESC
	f.Close()
	OSD("Ctrl-Alt-Esc Pressed`n`nExiting","Lime",30,3)
	Sleep 3000
ExitApp

*F12:: ; hotkey to pause or resume this script
PauseResume:
	Suspend, Toggle
	If(A_IsSuspended)
	{
		keys[key] := 0
		OSD("Paused`nF12 to Resume", "Yellow", 30, 0)
}
If(!A_IsSuspended)
	OSD("Running`nF12 to Pause","Lime",30,3)
Return

!^I::
	Run, %SettingsFile%
return

OnExit:
f.Close()
ExitApp

; Function to show OSD text
OSD(Text, Color:="Lime", Size:=30, TimeInSec:=3) {
Progress, y75 B ZH0 FM%Size% CWBlack CT%Color%,,%Text%, OSD,
WinSet, TransColor, Black, OSD
If(TimeInSec=0)
	Return
SetTimer, RemoveProgressBar, % TimeInSec * 1000
Return
RemoveProgressBar:
SetTimer, RemoveProgressBar, Off
Progress, Off
Return
}
ali_tx
Posts: 12
Joined: 11 Mar 2021, 06:33

Re: World Of Warcraft Press once A Hotkey And Spam it

11 Mar 2021, 09:06

sry but this script is like Press-and-Hold: Send or click while a button or key is held down
but i want to be like Toggle: Press once to activate, press again to turn it off tnx for your help & time
User avatar
Grendahl
Posts: 170
Joined: 30 Sep 2013, 08:21

Re: World Of Warcraft Press once A Hotkey And Spam it  Topic is solved

11 Mar 2021, 10:22

ali_tx wrote:
11 Mar 2021, 09:06
sry but this script is like Press-and-Hold: Send or click while a button or key is held down
but i want to be like Toggle: Press once to activate, press again to turn it off tnx for your help & time
Then change it to a toggle instead of a getkeystate.
ali_tx
Posts: 12
Joined: 11 Mar 2021, 06:33

Re: World Of Warcraft Press once A Hotkey And Spam it

11 Mar 2021, 11:22

Grendahl wrote:
11 Mar 2021, 10:22
ali_tx wrote:
11 Mar 2021, 09:06
sry but this script is like Press-and-Hold: Send or click while a button or key is held down
but i want to be like Toggle: Press once to activate, press again to turn it off tnx for your help & time
Then change it to a toggle instead of a getkeystate.
im realy sry cna you see my new topic i just got confused so i start to create new topic and i know my eng is not good :)
https://www.autohotkey.com/boards/viewtopic.php?f=76&t=87978
ali_tx
Posts: 12
Joined: 11 Mar 2021, 06:33

Re: World Of Warcraft Press once A Hotkey And Spam it

11 Mar 2021, 12:27

@Grendahl
is it possible to work even my world is on background ? plz can you help me if you know how to do it
User avatar
Grendahl
Posts: 170
Joined: 30 Sep 2013, 08:21

Re: World Of Warcraft Press once A Hotkey And Spam it

17 Apr 2021, 19:30

@ali_tx
No, because that would be game automation instead of a simple keyspammer, and would be against ToS.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: World Of Warcraft Press once A Hotkey And Spam it

17 Apr 2021, 20:37

Just for clarity: https://us.forums.blizzard.com/en/wow/t/clarification-on-tos-automation/606080/2

I'm not saying to not do it just saying... either way is technically against their TOS.
1 key press = 1 action is allowed.

Look at ControlSend to do what you want.
Have fun.

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 74 guests