Switch:Case - Up to 25?
Posted: 04 Jun 2023, 07:48
Hi folks, I just need a little guidance here with the Switch command. I like the way it uses a single hotkey to cycle through a list of commands, but I cannot figure out how to go above 4 Cases and I'm trying to cycle through 25 cases. I'm pretty sure it's just the math behind this, but I'm lost on how to get there.
Code: Select all
#SingleInstance, Force
#Persistent
^T::
; Switch ++N:=0 N&3 ; N = 1,2,3,4,1... (4 Cases only)
; Switch ++N:=0 N&24 ; N = 1,2,3-24,1...
; Switch (N - 1) % 25 + 1
Switch ++N:=0+1
{
Case 1: SplashTextOn,,, Displays a 1st title bar.
Soundbeep, 1400, 150
SplashTextOff
Case 2: SplashTextOn,,, Displays a 2nd title bar.
Soundbeep, 1450, 150
SplashTextOff
Case 3: SplashTextOn,,, Displays a 3rd title bar.
Soundbeep, 1500, 150
SplashTextOff
Case 4: SplashTextOn,,, Displays 4th... Next press goes back to 1st. ; NEEDS TO CONTINUE ON FROM HERE...
Soundbeep, 1550, 150
SplashTextOff
Case 5: SplashTextOn,,, Displays a 5th title bar.
Soundbeep, 1600, 150
SplashTextOff
Case 6: SplashTextOn,,, Displays a 6th title bar - and so on...
Soundbeep, 1650, 150
SplashTextOff
}
Return