Skip to content

Instantly share code, notes, and snippets.

@hidsh
Last active May 28, 2025 19:43
Show Gist options
  • Save hidsh/44cc2535799533d7e326dda1fe1163da to your computer and use it in GitHub Desktop.
Save hidsh/44cc2535799533d7e326dda1fe1163da to your computer and use it in GitHub Desktop.
an autohotkey script to toggle mute/unmute Arknights
#Requires AutoHotkey v2.0
#SingleInstance Force
soundvolPath := "D:\pgm\soundvolumeview-x64\SoundVolumeView.exe"
matchKey := "アークナイツ" ; used to find the session
muteTarget := "" ; will be set from CSV field[1] (Name column)
^!m::toggleMute()
toggleMute() {
global soundvolPath, matchKey, muteTarget
try {
tempFile := A_Temp "\svol_toggle.csv"
RunWait('"' soundvolPath '" /scomma "' tempFile '"')
raw := FileRead(tempFile, "UTF-8")
if !IsSet(raw) || raw = ""
throw Error("CSV is empty or unreadable.")
found := false
lines := StrSplit(raw, "`n")
for line in lines {
if InStr(line, matchKey) {
fields := StrSplit(line, ",", "`"")
if (fields.Length < 9)
continue
muteTarget := fields[1] ; Name column (for /Mute)
isMuted := (fields[9] = "Yes")
cmd := (isMuted ? "/Unmute" : "/Mute")
Run('"' soundvolPath '" ' cmd ' "' muteTarget '"')
timestamp := FormatTime(, "yyyy-MM-dd HH:mm:ss")
msg := (isMuted ? "🔊 Unmuted" : "🔇 Muted") . " @ " . timestamp
TrayTip("GPG Audio", msg, 5000)
found := true
break
}
}
if !found
TrayTip("GPG Audio", "⚠ Arknights session not found", 5000)
} catch Error as e {
TrayTip("GPG Audio Script Error", "❌ " . e.Message, 30000)
}
}

toggle-mute-arknights.ahk

prerequisites

Settings (in source code)

Line# Word Desc. Default
4 soundvolPath path to SoundVolumeView.exe "D:\pgm\soundvolumeview-x64\SoundVolumeView.exe"
5 matchKey window title for Arknights "アークナイツ" in japanese
8 ^!m::toggleMute() keybinding ^!mmeans Ctrl + Alt + m

Usage

  1. Start AutoHotkey
  2. Load this .ahk script via AutoHotkey icon from the Windows Task tray
  3. Press Ctrl + Alt + m to toggle mute/unmute
  4. (Optional) Compile to .exe if you prefer standalone
    e.g., v2.0.xx U64 AutoHotkey64.exe

Tested

  • AutoHotKey: v2.0.19
  • SoundVolumeView (x64): v2.47
  • Arknights: Global (locale: japan)
  • Google Play Games (Beta): 25.3.22.5
  • Windows 11 Pro: 23H2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment