From a2d061584f3c0fc42a0ad4c3911b4f0b7b455e6c Mon Sep 17 00:00:00 2001 From: Umiko Date: Fri, 2 May 2025 19:35:13 +0700 Subject: [PATCH] Updated few things on the script. --- capsLockSounds.ini | Bin 0 -> 236 bytes capsV3(Source).ahk | 110 ++++++++++++++++++++++++++++----------------- 2 files changed, 69 insertions(+), 41 deletions(-) create mode 100644 capsLockSounds.ini diff --git a/capsLockSounds.ini b/capsLockSounds.ini new file mode 100644 index 0000000000000000000000000000000000000000..23fb24ba93dee3e14dac9e2be89388a0dbb22a6a GIT binary patch literal 236 zcmaKmO$&lR6h+Tk@ULXn+N~f2E^-$xf>Z|li2Uf^TX%*`+{oR`n|t2leC8WhI!0O^ z#29J{dUAX`Qc7j*BQ*=#6L8|dn>*8wZg<#l!(Mc!= 2000 ms): Gui, Add, Edit, x10 y100 w100 vTimerInterval, %timerInterval% Gui, Add, Text, x120 y100, Timer Interval (ms) - Gui, Add, Button, x150 y130 w100 h30 gSaveSounds, Save - Gui, Add, Button, x100 y130 w100 h30 gCancel, Cancel + Gui, Add, Button, x150 y130 w100 h30 gSaveSoundSettings, Save + Gui, Add, Button, x100 y130 w100 h30 gCancelSettings, Cancel Gui, Show, , Select Sounds return -; Browse button for selecting the sound file when CapsLock is off -BrowseOffSound: +/** + * Browse for the sound file when CapsLock is off + */ +BrowseOffSoundFile: FileSelectFile, offSound, 1, , Select a sound file when CapsLock is off, Audio Files (*.wav; *.mp3) GuiControl,, OffSound, %offSound% return -; Browse button for selecting the sound file when CapsLock is on -BrowseOnSound: +/** + * Browse for the sound file when CapsLock is on + */ +BrowseOnSoundFile: FileSelectFile, onSound, 1, , Select a sound file when CapsLock is on, Audio Files (*.wav; *.mp3) GuiControl,, OnSound, %onSound% return -; Browse button for selecting the sound file for looping when CapsLock is on -BrowseLoopSound: +/** + * Browse for the looping sound file + */ +BrowseLoopSoundFile: FileSelectFile, loopSound, 1, , Select a sound file for looping when CapsLock is on, Audio Files (*.wav; *.mp3) GuiControl,, LoopSound, %loopSound% return -; Save button to save the selected sound files and timer interval -SaveSounds: - ; Save the selected sound file paths and timer interval to the INI file +/** + * Save selected sound files and timer interval to INI file + */ +SaveSoundSettings: IniWrite, %offSound%, %iniFile%, SoundFiles, OffSound IniWrite, %onSound%, %iniFile%, SoundFiles, OnSound IniWrite, %loopSound%, %iniFile%, SoundFiles, LoopSound GuiControlGet, timerInterval,, TimerInterval - ; Ensure timer interval is not below 2 seconds if (timerInterval < 2000) { timerInterval := 10000 - MsgBox, Timer duration should not be below 2000ms or 2 seconds. Timer set to 10seconds. + MsgBox, Timer duration should not be below 2000ms or 2 seconds. Timer set to 10 seconds. } IniWrite, %timerInterval%, %iniFile%, Settings, TimerInterval - MsgBox, configuration saved.. + MsgBox, Configuration saved. Gui, Destroy return -; Preview button functionality -PreviewOffSound: +/** + * Preview the selected off sound + */ +PreviewOffSoundFile: GuiControlGet, offSound, , OffSound if (offSound = "") { MsgBox, File path is empty. @@ -117,7 +136,10 @@ PreviewOffSound: } return -PreviewOnSound: +/** + * Preview the selected on sound + */ +PreviewOnSoundFile: GuiControlGet, onSound, , OnSound if (onSound = "") { MsgBox, File path is empty. @@ -128,7 +150,10 @@ PreviewOnSound: } return -PreviewLoopSound: +/** + * Preview the selected looping sound + */ +PreviewLoopSoundFile: GuiControlGet, loopSound, , LoopSound if (loopSound = "") { MsgBox, File path is empty. @@ -139,6 +164,9 @@ PreviewLoopSound: } return -Cancel: +/** + * Cancel and close the GUI + */ +CancelSettings: Gui, Destroy return