%%%THE Media Player%%%
import GUI
View.Set ("graphics;offscreenonly")
var dir : string := "C:/Documents and Settings/" + Sys.GetUserName + "/My Documents/My Music/"
Dir.Change (dir)
var stream : int := Dir.Open (dir)
var counter, scrollBar : int := 0
var filenameStorage : array 1 .. 200 of string
var filename, currentSong : string := ""
for i : 1 .. stream
filename := Dir.Get (stream)
exit when filename = ""
if filename (length (filename)) = '3' then
counter += 1
filenameStorage (counter) := filename
end if
end for
procedure ScrollBarMoved (value : int)
if value > 0 then
currentSong := filenameStorage (value)
Music.PlayFileStop
Music.PlayFileReturn (currentSong)
end if
end ScrollBarMoved
scrollBar := GUI.CreateVerticalScrollBar (maxx - 20, 10, maxy - 20,
0, counter, 0, ScrollBarMoved)
var welcomeFont : int := Font.New ("MS Sans Serif:20")
var songFont : int := Font.New ("Comic Sans MS:15")
loop
exit when GUI.ProcessEvent
Draw.FillBox (0, 0, maxx, maxy, black)
Font.Draw ("Welcome to THE Media Player!", 120, maxy - 40, welcomeFont, white)
if currentSong not= "" then
Font.Draw ("Playing " + currentSong, 150, maxy - 80, songFont, brightred)
end if
GUI.Refresh
View.Update
cls
end loop
|