Jump to content

Winamp Hotkeys!


Recommended Posts

Here's a an example that will let you use custom hotkeys for winamp, I wrote this because I find the hotkeys in Winamp are way to awkward, and I couldn't find any appropriate plugins to define custom hotkeys to my liking so I made this wrapper.

I am used to 1by1 so the hotkeys go like this

Quit - Press Esc
Play - Press Ctrl + Space
Play & Pause - Press Space
Stop - Press Ctrl + Enter
Stop & Play - Press Enter
Next - Press Up
Prev - Press Down
Seek Forward - Press Right
Seek Backword - Press Left
Volume Up - Press Page Up
Volume Down - Press Page Down

And the code, youll need this in the same directory, or just download the attachment.

Note: I commented out lines, 715, and 727 in the zip file because I was getting errors.

;If $iAutoItVersion_Compare <= 0 Then Local $iOld_Opt_REF = Opt("RunErrorsFatal", 0)

#include "Winamp_Library.au3"
Opt("TrayIconHide", 1)
Opt("WinTitleMatchMode", 4)

Global $WAL_GLOBAL = 0  ;0= Use for active Winamp window, 1= Set Global as Hotkeys
Global $WAL_WIN_HANDLE = "[TITLE:Main Window; CLASS:BaseWindow_RootWnd]"
Global $WAL_QUIT = "{esc}"
Global $WAL_PLAY = "^{space}"
Global $WAL_PLAYPAUSE = "{space}"
Global $WAL_STOP = "^{enter}"
Global $WAL_STOPPLAY = "{enter}"
Global $WAL_PLAY_NEXT = "{up}"
Global $WAL_PLAY_PREV = "{down}"
Global $WAL_SEEK_FORWARD = "{right}"
Global $WAL_SEEK_BACKWORD = "{left}"
Global $WAL_VOLUME_UP = "{pgup}"
Global $WAL_VOLUME_DOWN = "{pgdn}"
Global $WAL_VOLUME_INCREMENT = -1 ; If set to higher than -1 Custom volume increment will be used

Local $az_HotKeys[11] = _
[$WAL_QUIT, $WAL_PLAY, $WAL_PLAYPAUSE, $WAL_STOP, $WAL_STOPPLAY, $WAL_PLAY_NEXT, _
$WAL_PLAY_PREV, $WAL_SEEK_FORWARD, $WAL_SEEK_BACKWORD, $WAL_VOLUME_UP, $WAL_VOLUME_DOWN]
For $i = 0 To UBound($az_HotKeys)-1
    HotKeySet($az_HotKeys[$i], '_HotKey_Handler')
Next

While 1
    Sleep(100)
WEnd

Func _HotKey_Handler()
    Local $gzHotKeyPress = @HotKeyPressed
    If $WAL_GLOBAL Or WinActive($WAL_WIN_HANDLE) Then
        Switch $gzHotKeyPress
            Case $WAL_QUIT
                Exit
            Case $WAL_PLAY
                _Winamp_Play()
            Case $WAL_PLAYPAUSE
                 _Winamp_PlayPauseToggle()
            Case $WAL_STOP
                 _Winamp_Stop()
            Case $WAL_STOPPLAY
                _Winamp_Stop()
                _Winamp_Play()
            Case $WAL_PLAY_NEXT
                 _Winamp_Next()
            Case $WAL_PLAY_PREV
                 _Winamp_Previous()
            Case $WAL_SEEK_FORWARD
                _Winamp_Seek(-2)
            Case $WAL_SEEK_BACKWORD
                _Winamp_Seek(-1)
            Case $WAL_VOLUME_UP
                If $WAL_VOLUME_INCREMENT <> -1 Then
                    _Winamp_SetVolume(_Winamp_GetVolume() + $WAL_VOLUME_INCREMENT)
                Else
                    _Winamp_SetVolume(0, 1)
                EndIf
            Case $WAL_VOLUME_DOWN
                If $WAL_VOLUME_INCREMENT <> -1 Then
                    _Winamp_SetVolume(_Winamp_GetVolume() - $WAL_VOLUME_INCREMENT)
                Else
                    _Winamp_SetVolume(0, 0)
                EndIf
        EndSwitch
    Else
        HotKeySet($gzHotKeyPress)
        Send($gzHotKeyPress)
        HotKeySet($gzHotKeyPress, "_HotKey_Handler")
    EndIf
EndFunc

Huge thanks goes to MrCreatoR for taking the time on making the library see here for more information:

HotKeys.zip

Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...