Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Winamp Selectable Playlist OSD


  • Please log in to reply
1 reply to this topic
Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
This script will generate a BIG OSD track-selectable playlist menu. its very configurable and one of my most commented scripts.

it has turned out quite well, and its planned to bundle it with a software (usable with remote control).

the default keys are:
up -> playlist up
down ->playlist down
right -> select track
esc -> exit
(the keys can be re-configured easily)

Edit: Optimized the code a bit.

;___________________________________________
;______Winamp Playlist OSD Generator________
;___________________________________________


;___________________________________________
;______User Settings________________________

;Make customisation in this area or 
;hotkey area only!!


	;Playlist window size here
	SizeX = 720
	SizeY = 560

	;Number of tracks on list
	NumTracks = 8

	;Color choices
	ColorSelected = 333366
	ColorOther = 009988
	ColorBG = FFFFFF
	
	;BackGround Picture
	;(Picture used if available, otherwise ColorBG is used)
	PicBG = BG.GIF
	
	;Size of font
	FSize = 28


;Customise Hotkeys in Hotkey Customisation Section
;(below the next section)



;___________________________________________
;_____Auto Execute Section__________________

; DON'T CHANGE ANYTHING HERE!!
; (unless u know what u're doing)

	setbatchlines, 10ms
	SetWinDelay, 1
	DetectHiddenWindows, On
	#SingleInstance force

	;Makes the second run exit the script
	ifwinexist, Playlist Maker
	{
		winclose, RPlaylist
		winclose, Playlist Maker
		exitapp
	}
	WinSetTitle, %a_scriptfullpath%,, Playlist Maker
	
	
	;gets winamp info
	RegRead, wapath, REG_SZ, HKEY_CURRENT_USER, Software\Winamp,
	ifequal, wapath,, setenv, wapath, c:\program files\winamp
	Ifwinnotexist, ahk_class Winamp v1.x,,goto,nosong


	;saves playlist & gets track number
	SendMessage, 0x400, 0, 120,,ahk_class Winamp v1.x
	setenv, index, %ErrorLevel%



	;Create & run Playlist Gooeey   ;)
	winclose, RPlaylist
	gosub, create
	run, %temp%\temp.hta
	winwait, RPlaylist
	

	;sizing & centering Playlist window
	WinGetPos,,, dW, dH, Program Manager
	WinGetPos,,, wW, wH, %wtitle%, %wtext%
	dW -= %SizeX%
	dH -= %SizeY%
	dW /= 2
	dH /= 2
	WinMove, %wtitle%, %wtext%, %dW%, %dH%, %Sizex%, %Sizey%




;___________________________________________
;_____Hotkey Customisation Section__________

; User defined hotkeys here

; Up Playlist
UP::
	index --
	ifless, index, 0, setenv, index, 0
	gosub, create
	
	winactivate, RPlaylist
	send, {f5}	
Return


; Down Playlist
DOWN::
	ifless, index, 0, setenv, index, 0
	index ++
	gosub, create
	
	winactivate, RPlaylist
	send, {f5}	
Return



; Select Track
RIGHT::
	;sets track to play
	PostMessage, 0x400, %index%, 121,,ahk_class Winamp v1.x
	;plays track
	PostMessage, 0x111, 40045,,,ahk_class Winamp v1.x

return



; Exit Playlist
ESC::
	winclose, RPlaylist
	exitapp
Return


;___________________________________________
;______Change nothing below_________________



Create:
	SendMessage, 0x400, , 124,,ahk_class Winamp v1.x
	total = %errorlevel%
	ifgreater, index, %total%
	{
		index = %total%
		return
	}
	
	Loop, 5
	{
		track%a_index% =
		title%a_index% =
	}

	Readstart = %index%
	Readend = %index%
	Readend += %NumTracks%
	Readend --
	num = 0
	count = -1
	runs = %total%
	runs -= %index%
	ifgreater, runs, %NumTracks%, setenv, runs, %NumTracks%
	
	
	Loop, Read, %wapath%\winamp.m3u
	{
	    ifnotinstring, a_loopreadline, \, continue
	    ifinstring, a_loopreadline, #EXT, continue
	    count ++
	    
	    IfGreaterOrEqual, count, %ReadStart%
	    IfLessOrEqual, count, %ReadEnd%
	    {
		    num ++
		    index ++

		    FileReadLine, title, %wapath%\winamp.m3u, %a_index%
		    StringTrimRight, title, title, 4
		    StringGetPos, spos, title, \, R
		    spos ++

		    StringTrimLeft, title%num%, title, %spos%

		    track%num% = %index%
		    ifequal, num, %runs%, break
		    
	    }

	}
	index -= %runs%


	;Infobox
	filedelete, %temp%\temp.hta
	fileappend,<html>`n,%temp%\temp.hta
	fileappend,<title>RPlaylist</title>`n,%temp%\temp.hta
	fileappend,<HTA:APPLICATION ID="Wizard"`n,%temp%\temp.hta
	fileappend,BORDER="dialog"`n,%temp%\temp.hta
	fileappend,SCROLL="no"`n,%temp%\temp.hta
	fileappend,CAPTION="no"`n,%temp%\temp.hta
	fileappend,CONTEXTMENU="no"`n,%temp%\temp.hta
	fileappend,SHOWINTASKBAR="no"`n,%temp%\temp.hta
	fileappend,SINGLEINSTANCE="yes"`n,%temp%\temp.hta
	fileappend,</head>`n,%temp%\temp.hta
	fileappend,<body bgcolor="#%ColorBG%">`n,%temp%\temp.hta
	IfExist, %a_scriptdir%\%PicBG%, fileappend,<BODY background="%a_scriptdir%\%PicBG%">`n,%temp%\temp.hta
	

	Generate = %Runs%
	Loop, %generate%
	{
		StringTrimRight, CurrTrack, track%a_index%, 0
		StringTrimRight, CurrTitle, title%a_index%, 0
				
		IfEqual, a_index, 1
		{
			fileappend,<font color="#%ColorSelected%" face="Verdana" style="font-Size: %FSize%pt">`n,%temp%\temp.hta
			fileappend,%track1%. %title1%</font></p>`n,%temp%\temp.hta
		}

		IfNotEqual, a_index, 1
		{
			;to increase distance between 2 items on playlist, uncomment next line
			;fileappend, </p>`n,%temp%\temp.hta
			fileappend,<font color="#%ColorOther%" face="Verdana" style="font-Size: %FSize%pt">`n,%temp%\temp.hta
			fileappend,%CurrTrack%. %CurrTitle%</font></p>`n,%temp%\temp.hta
		}
	}
	fileappend,</body>`n,%temp%\temp.hta
	fileappend,</html>`n,%temp%\temp.hta
Return


ExitApp


nosong:
SplashTextOn , 200, 150,,`n`n OW COME ON!!`n`n Atleast run Winamp!!!
sleep, 2000
ExitApp

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
It's nice and big and it works well. It's a good example of integration with HTA.