Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: Controlling Winamp remotely
I love winbatch, even though it encourages my laziness :)
Here is winampclient.wbt, and winampserver.wbt. Winampserver sits on a "server" PC with winamp running, the other two sit on a "client" PC from which you can control various winamp functions (the ones I wanted, anyway). For more information, visit the winamp dev site at http://www.winamp.com/nsdn
Feel free to email me with any questions, and ESPECIALLY suggestions for improvements!
Darren Greenberg
Desktop Systems Engineer
dgreenberg@nb.com
;***************************** ; ; winampclient.wbt ; ;****************************** ;Darren Greenberg - 6/22/2000 ;dgreenberg@nb.com | sputnik@thepentagon.com ;"controls" winamp running on a different PC ;lots of stuff shamelessly ripped from the help files :) AddExtender("wwwsk34i.dll") IntControl (54, "", 1, 0, 0) IntControl (1002, 0, 0, 0, 0) ; hide winbatch icon if param0 != 0 if param1 == "/minimize" then goto minimize endif servername="sputnik" previoustrack=40044 nexttrack=40048 play=40045 playpause=40046 fastforward=40148 fastrewind=40144 :beginning while 1 MyDialogFormat=`WWWDLGED,5.0` MyDialogCaption=`Winamp Remote` MyDialogX=514 MyDialogY=44 MyDialogWidth=54 MyDialogHeight=38 MyDialogNumControls=8 MyDialog01=`0,24,18,DEFAULT,PUSHBUTTON,DEFAULT,"| <",1` MyDialog02=`36,24,18,DEFAULT,PUSHBUTTON,DEFAULT,"> |",2` MyDialog03=`18,24,18,DEFAULT,PUSHBUTTON,DEFAULT,"|>",3` MyDialog04=`18,12,18,DEFAULT,PUSHBUTTON,DEFAULT,"| |",4` MyDialog05=`36,12,18,DEFAULT,PUSHBUTTON,DEFAULT,">>",5` MyDialog06=`0,12,18,DEFAULT,PUSHBUTTON,DEFAULT,"<<",6` MyDialog07=`0,0,26,DEFAULT,PUSHBUTTON,DEFAULT,"&Minimize",10` MyDialog08=`26,0,26,DEFAULT,PUSHBUTTON,DEFAULT,"&GetName",99` ButtonPushed=Dialog("MyDialog") ;for some reason I couldn't connect the commands directly to the pushbuttons ;apparently there is a limit to how large the number can be - didn't feel like researching it though! switch buttonpushed case 1 command=previoustrack break case 2 command=nexttrack break case 3 command=play break case 4 command=playpause break case 5 command=fastforward break case 6 command=fastrewind break case 10 goto minimize case 99 command=99 break endswitch talksocket=sOpen() ret=sConnect(talksocket, servername, "ftp") sSendLine(talksocket, command) songname=sRecvLine(talksocket, 7500) Message("Song Name", songname) sClose(talksocket) endwhile :MINIMIZE IntControl(1007, 1, 2, "Winamp Remote", "winampclient.exe") IntControl(1007, 2, 1, "", "") goto beginning
;***************************** ; ; winampserver.wbt ; ;****************************** ;Darren Greenberg - 6/22/2000 ;dgreenberg@nb.com | sputnik@thepentagon.com ;lets winampclient.exe control winamp from a different PC ;lots of stuff shamelessly ripped from the help files :) AddExtender("wwwsk34I.dll") IntControl (54, "", 1, 0, 0) IntControl (1002, 0, 0, 0, 0) ; hide winbatch icon listensocket=sOpen() sListen(listensocket, "ftp") ; use ftp port for lack of anything better Served=0 while 1 datasocket=sAccept(listensocket, @TRUE) ; Block for a connection if datasocket gosub ProcessConnect else sClose(listenSocket) msg=wxGetLastErr() Message("Socket Error", msg) exit endif endwhile exit :ProcessConnect command=sRecvLine(datasocket, 20) if command != 99 hwnd = DLLHwnd("~Winamp") WM_COMMAND=273 IntControl(23, hwnd, WM_COMMAND, command, 0) endif gosub getname sClose(datasocket) return :getname allwins=WinItemize() target=StrIndex(allwins, "- Winamp", 1, @FWDSCAN) beginning=StrIndexNC(allwins, @TAB, target, @BACKSCAN) beginning=StrIndexNC(allwins, ".", beginning, @FWDSCAN) ending=StrIndexNC(allwins, @TAB, target, @FWDSCAN) name=StrSub(allwins, beginning+2, ending-beginning-10) sSendLine(datasocket,name) return
;***************************** ; ; webampclient.html ; ;****************************** <html> <head> <META HTTP-EQUIV="Refresh" CONTENT="15; URL=http://|refreshsong"> <title> WebAmp </title> <base href="{{Value BaseDirectory}}"> </head> <body background="goldback.bmp"> <div align="center"> <center> <a href="|6"><img border="0" src="fastrewind.bmp" width="23" height="18" alt="Fast Rewind"></a><a href="|4"><img border="0" src="pause.bmp" width="23" height="18" alt="Pause"></a><a href="|5"><img border="0" src="fastforward.bmp" width="22" height="18" alt="Fast Forward"></a> </center> </div> <div align="center"> <center> <a href="|1"><img border="0" src="previoustrack.bmp" width="23" height="18" alt="Previous Track"></a><a href="|3"><img border="0" src="play.bmp" width="23" height="18" alt="Play"></a><a href="|2"><img border="0" src="nexttrack.bmp" width="22" height="18" alt="Next Track"></a> </center> <marquee>{{getsongname SongName}}</marquee> </html> ;***************************** ; ; webampclient.wbt ; ;****************************** ;Darren Greenberg - 6/22/2000 ;dgreenberg@nb.com | sputnik@thepentagon.com ;"controls" winamp running on a different PC via the HTML extender ;lots of stuff shamelessly ripped from the help and sample files :) AddExtender("WWHTM34I.DLL") AddExtender("wwwsk34I.dll") IntControl (54, "", 1, 0, 0) IntControl (1002, 0, 0, 0, 0) ; hide winbatch icon servername="sputnik" hBrowseSetPos(750, 150, 880, 305) ;Winamp Constants previoustrack=40044 nexttrack=40048 play=40045 playpause=40046 fastforward=40148 fastrewind=40144 basedirectory=DirGet() htmlfile=strcat(basedirectory, "webampclient.html") tempfile=strcat(basedirectory, "webampclienttemp.html") WinTitle("", "WebAmp") bb=BinaryAlloc(10000) while 1 BinaryEODSet(bb, 0) BinaryRead(bb, htmlfile) structure=BinaryTagInit(bb, "{{", "}}") while 1 structure=BinaryTagFind(structure) if structure == "" then break wbdata=StrTrim(BinaryTagExtr(structure, 1)) wbcmd=StrLower(ItemExtract(1, wbdata, " ")) wbparams=StrTrim(StrSub(wbdata, StrLen(wbcmd)+1, -1)) htmlvalue="???????" gosub %wbcmd% structure=BinaryTagRepl(structure, htmlvalue) endwhile BinaryWrite(bb, tempfile) url=hBrowse(2, tempfile, 2) if url == "" then break keyword=ItemExtract(2, url, "|") if keyword == "refreshsong/" gosub getsongname continue else switch keyword case 1 command=previoustrack break case 2 command=nexttrack break case 3 command=play break case 4 command=playpause break case 5 command=fastforward break case 6 command=fastrewind break endswitch endif talksocket=sOpen() ret=sConnect(talksocket, servername, "ftp") sSendLine(talksocket, command) htmlvalue=sRecvLine(talksocket, 7500) sClose(talksocket) endwhile exit ; bye :value htmlvalue=%wbparams% return :getsongname talksocket=sOpen() ret=sConnect(talksocket, servername, "ftp") sSendLine(talksocket, 99) htmlvalue=sRecvLine(talksocket, 7500) sClose(talksocket) return
Article ID: W14715
Filename: Controlling Winamp remotely.txt
File Created: 2001:03:01:12:19:30
Last Updated: 2001:03:01:12:19:30