Jump to content

Winamp Control


Helge
 Share

Recommended Posts

This was just something I made recently so that I could control my Winamp

when I was playing games..

(I'm currently playing Action Supercross B))

I've only tested it on Winamp version 2.91, but it should at least work

on any 2.x versions...

And yeah, I know the code is messy... :whistle:

Opt("WinTitleMatchMode", 2)
$PLAYPAUSE_TOGGLE = "b"

HotKeySet("^{HOME}", "PLAYPAUSE")
HotKeySet("^{END}", "Stop")
HotKeySet("^{PGUP}", "NextSong")
HotKeySet("^{PGDN}", "PrevSong")
HotKeySet("^{INS}", "VolUp")
HotKeySet("^{DEL}", "VolDown")

MsgBox(64, "Winamp Control", "Ctrl + Home : Play/Pause" & @LF & "Ctrl + End : Stop" & @LF & @LF & "Ctrl + PageUp : Next song" & @LF & "Ctrl + PageDown : Previous song" & @LF & @LF & "Ctrl + Insert : Volume up" & @LF & "Ctrl + Delete : Volume down")

While 1
Sleep(50)
WEnd

;==================================================
Func PLAYPAUSE()
Sleep(50)

If $PLAYPAUSE_TOGGLE = "c" Then
$PLAYPAUSE_TOGGLE = "x"
Else
$PLAYPAUSE_TOGGLE = "c"
EndIf

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", $PLAYPAUSE_TOGGLE, 1)
EndIf

EndFunc
;==================================================
Func STOP()
Sleep(50)

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", "v", 1)
EndIf

EndFunc
;==================================================
Func NEXTSONG()
Sleep(50)

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", "b", 1)
EndIf

EndFunc
;==================================================
Func PREVSONG()
Sleep(50)

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", "z", 1)
EndIf

EndFunc
;==================================================
Func VOLUP()
Sleep(50)

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", "{UP}", 0)
EndIf

EndFunc
;==================================================
Func VOLDOWN()
Sleep(50)

$TITLE = WinGetTitle("- Winamp", "")

If $TITLE = 0 Then
Else
ControlSend ($TITLE, "", "", "{DOWN}", 0)
EndIf

EndFunc
;==================================================
Link to comment
Share on other sites

Ok, this is actually the first functional code I've bothered working on with AI3 (clap clap). I tried using the code but i run WinAmp3, so some of the functions were a little screwy with my computer, and i wanted to change the programs functionality a little. Here is my working script for WinAmp3 with some changes from Helge's

-End closes winamp instead of stopping it

-volume up and down have no delay

-hot keys are different

-cleaned up a little

-annoying credits thing (just disable it, but when i change other peoples' codes i always add thier name and mine somewhere)

Opt("WinTitleMatchMode", 2)
HotKeySet("^{PGDN}", "PLAYPAUSE")
HotKeySet("^{END}", "STOP")
HotKeySet("^{RIGHT}", "NEXTSONG")
HotKeySet("^{LEFT}", "PREVSONG")
HotKeySet("^{UP}", "VOLUP")
HotKeySet("^{DOWN}", "VOLDOWN")
ToolTip ( "Original code by Helge    .~^~.    Updated for WinAmp3 by Insanepyrokid" , 330, 250 )
MsgBox(64, "Winamp3 Control", "Ctrl + PageDown : Play/Pause" & @LF & "Ctrl + End : Closes WinAmp and ends program" & @LF & "Ctrl + Right : Next song" & @LF & "Ctrl + Left : Previous song" & @LF & "Ctrl + Up : Volume up" & @LF & "Ctrl + Down : Volume down")
ToolTip ( "" ,0,0)   ;Clears first ToolTip
While 1
Sleep(50)
WEnd
;==================================================PAUSE SETTINGS
Func PLAYPAUSE()
Sleep(50)
$TITLE = WinGetTitle("(playing)", "")
If $TITLE = "0" Then
$TITLE = WinGetTitle("(paused)", "")
ControlSend ($TITLE, "", "", "c", 1)
else
ControlSend ($TITLE, "", "", "c", 1)
endif
EndFunc
;==================================================STOP SETTINGS
Func STOP()
Sleep(50)
$TITLE = WinGetTitle("(playing)", "")
winclose($TITLE,)
Exit 0
EndFunc
;==================================================NEXT SONG SETTINGS
Func NEXTSONG()
Sleep(50)
$TITLE = WinGetTitle("(playing)", "")
ControlSend ($TITLE, "", "", "b", 1)
EndFunc
;==================================================PREVIOUS SONG SETTINGS
Func PREVSONG()
Sleep(50)
$TITLE = WinGetTitle("(playing)", "")
ControlSend ($TITLE, "", "", "z", 1)
EndFunc
;==================================================VOLUME UP SETTINGS
Func VOLUP()
$TITLE = WinGetTitle("(playing)", "")
ControlSend ($TITLE, "", "", "{UP}", 0)
EndFunc
;==================================================VOLUME DOWN SETTINGS
Func VOLDOWN()
$TITLE = WinGetTitle("(playing)", "")
ControlSend ($TITLE, "", "", "{DOWN}", 0)
EndFunc

Well tell me how it works and all, my first piece of code i worked on with AI3. For those of you with WinAmp3 :whistle:

Thanks for the original code Helge! B)

Link to comment
Share on other sites

Oh and i didnt bother adding the If's that check if it found the window, i assume if your running this program you're going to know if winamp is open or not :whistle: and the reason Helge's code doesnt work on WinAmp3 is that after the first song change, "- WinAmp" is no longer in the window title, so the script stops working. if anybody is going to change the script any further, look for "(playing)" in the window title

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...