File Destination: C:\Program Files\EqualizerAPO\config\config.txt
File Contents:
Code: Select all
Filter: ON LSC Fc 170 Hz Gain 0 dB Q 0.44
Filter: ON HSC Fc 2096 Hz Gain 0 dB Q 0.44
Preamp: 0 dB
Code: Select all
Filter: ON LSC Fc 170 Hz Gain 0 dB Q 0.44
Filter: ON HSC Fc 2096 Hz Gain 0 dB Q 0.44
Preamp: 0 dB
Code: Select all
#Requires AutoHotkey v2.0.2
^4::ChangeGain(+1)
^5::ChangeGain(-1)
ChangeGain(value) {
static path := 'C:\Program Files\EqualizerAPO\config\config.txt'
fileContents := FileOpen(path, 'r').Read()
static gainDigitsRegex := 'm)Gain \K\d+'
GetCurrentGain() {
if !RegExMatch(fileContents, gainDigitsRegex, &M)
throw Error('couldnt find "Gain <numbers>" inside the file, aborting', -1, path)
return M[0]
}
newFileContents := RegExReplace(fileContents, gainDigitsRegex, GetCurrentGain() + value)
FileOpen(path, 'w').Write(newFileContents)
}
Code: Select all
ChangeGain(value) {
static path := 'C:\Program Files\EqualizerAPO\config\config.txt'
fileContents := FileOpen(path, 'r').Read()
static gainDigitsRegex := 'm)Gain \K[-+]?[0-9]*\.?[0-9]+'
GetCurrentGain() {
if !RegExMatch(fileContents, gainDigitsRegex, &M)
throw Error('couldnt find "Gain <numbers>" inside the file, aborting', -1, path)
return M[0]
}
newFileContents := RegExReplace(fileContents, gainDigitsRegex, Round(GetCurrentGain() + value, 2))
FileOpen(path, 'w').Write(newFileContents)
}