Control Send script help for a game

Ask gaming related questions
xzvn12359
Posts: 1
Joined: 05 Mar 2024, 04:00

Control Send script help for a game

Post by xzvn12359 » 05 Mar 2024, 04:08

Hello guys, I'm new to AHK and don't even know the basics.

I'm trying to create an AHK macro for WOW that will press 1 macro (for chat message) bound to F6 key with random delays between 45 seconds and 2 minutes + movement key (W) once for random amount of time between 0.5 and 2 seconds.
I also wanted to add toggling (on/off) by pressing F7/F8 keys. Can it be done to send it to the game when it's tabbed with ControlSend?
Thanks for your help in advance

User avatar
WarlordAkamu67
Posts: 220
Joined: 21 Mar 2023, 06:52

Re: Control Send script help for a game

Post by WarlordAkamu67 » 05 Mar 2024, 12:03

Hello. Try this:

Code: Select all

#Requires Autohotkey v2.0+
SendMode("Event")

; ========== ; ========== ; ========== ; ========== ; ========== ;

F7:: {
  ToolTip("Starting...")
  SetTimer () => ToolTip(), -1000
  SetTimer(pressButton, -1)
  return
}

; ========== ; ========== ; ========== ; ========== ; ========== ;

F8:: {
  SetTimer(pressButton, 0)
  ToolTip("Stopping...")
  SetTimer () => ToolTip(), -1000
  return
}

; ========== ; ========== ; ========== ; ========== ; ========== ;

pressButton() {
  global timer_Toggle
  static window_ID := WinExist("World of Warcraft")
  ControlSend("{F6}{w down}", window_ID)
  Sleep(Random(500,2000))
  ControlSend("{w up}", window_ID)
  SetTimer(pressButton, -(Random(4500, 12000)))
  return
}

Post Reply

Return to “Gaming”