LOL it's twisted and it works.
This is for selecting tracks in Winamp using digits. There might have been better ways of doing this, but I couldn't come up with any others that would let it work the way I wanted. You could probably make this global as well if you cared by using #IfWinExist instead of #IfWinActive. More software players should have this feature. Many hardware players do. Don't complain if it doesn't look pretty. I'm not a programmer. I just hack at it until it does what I want it to. You can either use extended 1 through 0 or the numeric keypad in which case NumLock has to be on. The number of digits you have to enter is based on how many tracks are currently loaded. I.E. 1 if there are less than 10 tracks, 2 if there are 10 to 99 tracks etc up to a maximum of 4 digits.
Add this part to the Auto-Execute section
Code:
GroupAdd Winamp, ahk_class Winamp v1.x
GroupAdd Winamp, ahk_class Winamp PE
GroupAdd Winamp, ahk_class Winamp Video
GroupAdd Winamp, ahk_class Winamp Gen
You can put this part where ever you like
Code:
;Select Tracks Using Keypad In Winamp
#IfWinActive ahk_group Winamp
0::
Numpad0::
1::
Numpad1::
2::
Numpad2::
3::
Numpad3::
4::
Numpad4::
5::
Numpad5::
6::
Numpad6::
7::
Numpad7::
8::
Numpad8::
9::
Numpad9::
SendMessage 1024, 0, 124,, ahk_class Winamp v1.x
TrackCount = %ErrorLevel%
StringLen DigitCount, TrackCount
If DigitCount = 1
StringRight DGT1, A_ThisHotkey, 1
If (A_TimeSincePriorHotkey > 2000 || A_TimeSincePriorHotkey = -1)
If DigitCount > 1
{
StringRight DGT1, A_ThisHotkey, 1
KeyCount = 1
Return
}
If A_TimeSincePriorHotkey < 2000
{
If DigitCount > 1
{
If A_PriorHotkey Not In 0,Numpad0,1,Numpad1,2,Numpad2,3,Numpad3,4,Numpad4,5,Numpad5,6,Numpad6,7,Numpad7,8,Numpad8,9,Numpad9
{
StringRight DGT1, A_ThisHotkey, 1
KeyCount = 1
Return
}
If (KeyCount = DigitCount)
{
StringRight DGT1, A_ThisHotkey, 1
KeyCount = 1
Return
}
}
If (DigitCount = 2 && KeyCount = 1)
{
StringRight DGT2, A_ThisHotkey, 1
KeyCount = 2
}
If DigitCount = 3
{
If KeyCount = 1
{
StringRight DGT2, A_ThisHotkey, 1
KeyCount = 2
Return
}
Else
{
StringRight DGT3, A_ThisHotkey, 1
KeyCount = 3
}
}
If DigitCount = 4
{
If KeyCount = 1
{
StringRight DGT2, A_ThisHotkey, 1
KeyCount = 2
Return
}
Else
If KeyCount = 2
{
StringRight DGT3, A_ThisHotkey, 1
KeyCount = 3
Return
}
Else
{
StringRight DGT4, A_ThisHotkey, 1
KeyCount = 4
}
}
}
Track = %DGT1%%DGT2%%DGT3%%DGT4%
DGT1 =
DGT2 =
DGT3 =
DGT4 =
DigitCount =
Track -= 1
TrackCount -= 1
If (Track > TrackCount || Track = -1)
{
Track =
TrackCount =
Return
}
SendMessage 1024, %Track%, 121,, ahk_class Winamp v1.x
PostMessage 273, 40045, 0,, ahk_class Winamp v1.x
Track =
TrackCount =
Return
#IfWinActive