I added a playlist function to this. I never really got around to making it look better, but I'm used to this. I think I changed everything I needed to, and I think I forgot to do something with the delete playlist, but I don't remember. I also think I stopped making the reset have error messages.
(It's my own work by hand, too)
menu channel,status {
Jon's Mp3:/mp
}
alias mp {
if (!$dialog(jons_mp)) {
dialog -md jons_mp jons_mp
}
}
dialog jons_mp {
title "Jon's Mp3 Player Version 2.0"
size -1 -1 500 225
list 1, 5 5 200 200
button "Add", 2, 210 5 40 30
button "Whole List", 3, 300 5 60 30
button "Delete", 4, 255 5 40 30
edit "", 5, 5 200 490 20, read
edit "", 6, 210 40 150 20, read autohs
button "Set Dir", 7, 365 40 40 20
button "Reset", 8, 365 5 40 30
button "Play", 9, 210 160 50 30, default
button "Stop", 10, 265 160 50 30
button "Pause", 11, 320 160 50 15
button "Resume", 12, 320 175 50 15
box "Songs Played", 13, 210 65 160 90
edit "1", 14, 215 80 75 20
button "Set", 15, 290 80 75 20
button "Play All", 16, 215 105 150 20
button "Repeat", 17, 215 130 150 20
check "Random", 18, 375 65 60 15
check "Message in Channel", 19, 375 85 115 15
list 20, 5 5 200 200, hide
button "Options", 21, 410 5 50 30
button "Random", 22, 435 65 55 20
button "Send Message", 23, 375 105 115 20
button "Mute", 24, 375 160 50 30
menu "Playlist", 25
item "New", 26, 25
item "Open", 27, 25
item "Delete", 28, 25
}
on *:DIALOG:jons_mp:sclick:*: {
if ($did == 1) {
set %jonsmp.line $did(jons_mp,1).sel
set %jonsmp.selected $did(jons_mp,1).seltext
}
if ($did == 2) {
var %jonsmp.file = $sfile(%jonsmp.dir,Choose an mp3. . .,Add)
if (%jonsmp.file != $null) {
set %jonsmp.songs $calc(%jonsmp.songs + 1)
hadd -m %jonsmp.currentplaylist songs [ $+ [ %jonsmp.songs ] ] $nopath(%jonsmp.file)
hadd -m %jonsmp.currentplaylist dirs [ $+ [ %jonsmp.songs ] ] $nofile(%jonsmp.file)
hsave -o %jonsmp.currentplaylist $eval(%jonsmp.currentplaylist $+ .hsh)
dialog -x jons_mp
mp
}
}
if ($did == 3) {
var %jonsmp.wtf = $findfile(%jonsmp.dir,%jonsmp.mp3orwma,0,did -a jons_mp 20 $1-)
var %jonsmp.temp.lines = $did(jons_mp,20).lines
var %jonsmp.temp.checking.hash = 1
while (%jonsmp.temp.lines >= %jonsmp.temp.checking.hash) {
set %jonsmp.songs $calc(%jonsmp.songs + 1)
hadd -m %jonsmp.currentplaylist songs [ $+ [ %jonsmp.songs ] ] $nopath($findfile(%jonsmp.dir,%jonsmp.mp3orwma, $+ [ %jonsmp.temp.checking.hash ] $+ ))
hadd -m %jonsmp.currentplaylist dirs [ $+ [ %jonsmp.songs ] ] $nofile($findfile(%jonsmp.dir,%jonsmp.mp3orwma, $+ [ %jonsmp.temp.checking.hash ] $+ ))
hsave -o %jonsmp.currentplaylist %jonsmp.currentplaylist $+ .hsh
inc %jonsmp.temp.checking.hash 1
}
dialog -x jons_mp
mp
}
if ($did == 4) {
var %jonsmp.line = $did(jons_mp,1).sel
var %jonsmp.checking.hash = $calc(%jonsmp.line - 1)
while (%jonsmp.songs > %jonsmp.checking.hash) {
inc %jonsmp.checking.hash 1
hadd %jonsmp.currentplaylist dirs [ $+ [ %jonsmp.checking.hash ] ] $hget(%jonsmp.currentplaylist,dirs [ $+ [ $calc(%jonsmp.checking.hash + 1) ] ] ))
hadd %jonsmp.currentplaylist songs [ $+ [ %jonsmp.checking.hash ] ] $hget(%jonsmp.currentplaylist,songs [ $+ [ $calc(%jonsmp.checking.hash + 1) ] ] ))
hdel %jonsmp.currentplaylist songs [ $+ [ $calc(%jonsmp.checking.hash + 1) ] ]
hdel %jonsmp.currentplaylist dirs [ $+ [ $calc(%jonsmp.checking.hash + 1) ] ]
}
hdel %jonsmp.currentplaylist songs [ $+ [ %jonsmp.songs ] ]
hdel %jonsmp.currentplaylist dirs [ $+ [ %jonsmp.songs ] ]
set %jonsmp.songs $calc(%jonsmp.songs - 1)
dialog -x jons_mp
mp
}
if ($did == 7) {
var %jonsmp.new.dir = $sdir="Mp3 directory" c:
if (%jonsmp.new.dir != $null) {
set %jonsmp.dir %jonsmp.new.dir
did -r jons_mp 6
did -a jons_mp 6 %jonsmp.dir
}
else {
echo -a You didn't select a file.
}
}
if ($did == 8) {
hdel -w %jonsmp.currentplaylist songs*
hdel -w %jonsmp.currentplaylist dirs*
set %jonsmp.songs 0
dialog -x jons_mp
mp
}
if ($did == 9) {
var %jonsmp.line = $did(jons_mp,1).sel
set %jonsmp.p $did(jons_mp,1).seltext
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
set %jonsmp.songs.played 1
jons_mp_songs_played
if (%jonsmp.message == yes) {
amsg $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~
}
}
if ($did == 10) {
splay stop
}
if ($did == 11) {
splay Pause
}
if ($did == 12) {
splay Resume
}
if ($did == 15) {
set %jonsmp.songs.playing $did(jons_mp,14).text
did -t jons_mp 9
jons_mp_songs_played
}
if ($did == 16) {
did -c jons_mp 1 1
set %jonsmp.songs.playing $did(jons_mp,1).lines
jons_mp_songs_played
var %jonsmp.line = $did(jons_mp,1).sel
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
}
if ($did == 17) {
if (%jonsmp.repeat == no) {
set %jonsmp.repeat wait
.timer 1 .2 /set %jonsmp.repeat yes
did -r jons_mp 17
did -a jons_mp 17 Unrepeat
}
if (%jonsmp.repeat == yes) {
set %jonsmp.repeat no
did -r jons_mp 17
did -a jons_mp 17 Repeat
}
}
if ($did == 18) {
if (%jonsmp.random == no) {
set %jonsmp.random wait
.timer 1 .2 /set %jonsmp.random yes
}
if (%jonsmp.random == yes) {
set %jonsmp.random no
}
}
if ($did == 19) {
if (%jonsmp.message == no) {
set %jonsmp.message wait
.timer 1 .2 /set %jonsmp.message yes
}
if (%jonsmp.message == yes) {
set %jonsmp.message no
}
}
if ($did == 21) {
if (!$dialog(jons_mp_options)) {
dialog -mv jons_mp_options jons_mp_options
}
}
if ($did == 22) {
set %jonsmp.line $rand(1,$did(jons_mp,1).lines)
did -c jons_mp 1 %jonsmp.line
set %jonsmp.p $did(jons_mp,1).seltext
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
set %jonsmp.songs.played 1
jons_mp_songs_played
if (%jonsmp.message == yes) {
amsg $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~
}
}
if ($did == 23) {
msg $active $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~
}
if ($did == 24) {
if ($vol(master).mute == $false) { vol -vu1 | did -o jons_mp 24 1 Unmute } | elseif ($vol(master).mute == $true) { vol -vu2 | did -o jons_mp 24 1 Mute }
}
}
on *:Dialog:Jons_mp:menu:*: {
if ($did == 26) {
dialog -mv New_Playlist New_Playlist
}
if ($did == 27) {
dialog -mv Open_Playlist Open_Playlist
}
if ($did == 28) {
dialog -mv del_playlist del_playlist
}
}
dialog Open_Playlist {
title "Playlist"
size -1 -1 200 95
list 1, 5 5 190 95
}
dialog Del_Playlist {
title "Playlist"
size -1 -1 200 95
list 1, 5 5 190 95
}
on *:DIALOG:del_playlist:init:0 {
var %x = 0
while (%jonsmp.playlists > %x) {
inc %x
did -a del_Playlist 1 $eval($chr(37) $+ jonsmp.playlist. $+ %x,2)
}
}
on *:DIALOG:del_playlist:dclick:1: {
hfree $did(del_playlist,1).seltext
set %jonsmp.playlists $calc(%jonsmp.playlists - 1)
unset %jonsmp.playlist. $+ $did(del_playlist,1).sel
if (%jonsmp.playlists >= $did(del_playlist,1).sel) {
}
dialog -x del_playlist
}
on *:DIALOG:open_playlist:init:0 {
var %x = 0
while (%jonsmp.playlists > %x) {
inc %x
did -a Open_Playlist 1 $eval($chr(37) $+ jonsmp.playlist. $+ %x,2)
}
}
on *:DIALOG:open_playlist:dclick:*: {
set %jonsmp.currentplaylist $did(open_playlist,1).seltext
if ($hget(%jonsmp.currentplaylist,0).item > 1) {
set %jonsmp.songs $calc($hget(%jonsmp.currentplaylist,0).item / 2)
}
if ($hget($did(open_playlist,1).seltext,0).item < 1) {
set %jonsmp.songs 0
}
dialog -x open_playlist
dialog -x jons_mp
mp
}
dialog New_Playlist {
title "Playlist"
size -1 -1 300 60
text "What will you call the new playlist?", 1, 5 5 300 20
edit "", 2, 5 30 290 20
button "Go", 3, 0 0 0 0, default
}
on *:DIALOG:New_Playlist:sclick:*: {
if ($did == 3) {
inc %jonsmp.playlists
set %jonsmp.playlist. $+ %jonsmp.playlists $did(New_Playlist,2).text
hmake $did(New_Playlist,2).text 100
dialog -x New_Playlist
}
}
on *:DIALOG:jons_mp:edit:14: {
did -t jons_mp 15
}
on *:DIALOG:jons_mp:init:0: {
did -a jons_mp 6 %jonsmp.dir
did -a jons_mp 1 $hget(%jonsmp.currentplaylist,songs [ $+ [ 1 ] ] ))
var %jonsmp.checking.hash = 1
var %jonsmp.finding = [ $calc($hfind(%jonsmp.currentplaylist,*,0,w) / 2) ]
while (%jonsmp.songs > %jonsmp.checking.hash) {
inc %jonsmp.checking.hash 1
did -a jons_mp 1 $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.checking.hash ] ] ))
}
did -c jons_mp 1 %jonsmp.line
jons_mp_songs_played
if (%jonsmp.repeat == yes) {
did -r jons_mp 17
did -a jons_mp 17 Unrepeat
}
if (%jonsmp.random == yes) {
did -c jons_mp 18
}
if (%jonsmp.message == yes) {
did -c jons_mp 19
}
}
on *:DIALOG:jons_mp:dclick:1: {
var %jonsmp.line = $did(jons_mp,1).sel
set %jonsmp.p $did(jons_mp,1).seltext
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
set %jonsmp.songs.played 1
jons_mp_songs_played
if (%jonsmp.message == yes) {
amsg $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~
}
}
alias jons_mp_songs_played {
if (%jonsmp.songs.playing == 1) {
did -r jons_mp 5
did -a jons_mp 5 You have played %jonsmp.songs.played $+ / $+ %jonsmp.songs.playing song.
}
else {
did -r jons_mp 5
did -a jons_mp 5 You have played %jonsmp.songs.played $+ / $+ %jonsmp.songs.playing songs.
}
}
on *:LOAD: {
if ($hget(Default) != Default) {
hmake Default 100
}
set %jonsmp.dir C:Documents and SettingsOwnerMy DocumentsMy Music
set %jonsmp.songs 0
set %jonsmp.songs.playing 1
set %jonsmp.repeat no
set %jonsmp.random no
set %jonsmp.message no
set %jonsmp.mp3orwma *.mp3
set %jonsmp.playlists 1
set %jonsmp.playlist.1 Default
%jonsmp.currentplaylist Default
echo -a You have just loaded Jon's Mp3 Player Version 2.0! Open with /mp
}
on *:MP3END: {
if (%jonsmp.repeat == yes) {
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
halt
}
if (%jonsmp.songs.played >= %jonsmp.songs.playing) {
halt
}
if (!$dialog(jons_mp)) {
mp
var %jonsmp.dunno yes
}
if (%jonsmp.random == no) {
set %jonsmp.line $calc(%jonsmp.line + 1)
}
else {
set %jonsmp.line $rand(1,$did(jons_mp,1).lines)
}
did -c jons_mp 1 %jonsmp.line
splay $hget(%jonsmp.currentplaylist,dirs [ $+ [ %jonsmp.line ] ] ) $+ $hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] )
set %jonsmp.songs.played $calc(%jonsmp.songs.played + 1)
jons_mp_songs_played
if (%jonsmp.message == yes) {
amsg $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~
}
if (%jonsmp.dunno == yes) {
dialog -x jons_mp
}
}
dialog jons_mp_options {
title "Jon's Mp3 Options"
size -1 -1 100 100
list 1, 5 5 50 95
text "Choose which type of file to add for the whole list function", 2, 55 0 50 90
}
on *:DIALOG:jons_mp_options:init:0: {
didtok jons_mp_options 1 44 *.wma,*.mp3
}
on *:DIALOG:jons_mp_options:sclick:1: {
set %jonsmp.mp3orwma $did(jons_mp_options,1).seltext
dialog -x jons_mp_options
}
alias F12 { /msg $active $me likes 9~*~ $remove($hget(%jonsmp.currentplaylist,songs [ $+ [ %jonsmp.line ] ] ),.mp3,.wma) 9~*~ }
Is What Happens When I Try And Add A Song Better Work On That..
I can comment everywhere i want to, and it happens to be that i have this script run perfectly and this is a real snipped. I can post politely. However, If you keep posting \"1 command alliases with Identifiers\"I mean, The only thing it might be usefull is 2 scripters themself. That means, I dont find it usefull, Neither do scripters because they write theyr own stuff with identifiers.