All pastes #766529 Raw Edit

mIRC MP3 Player

public text v1 · immutable
#766529 ·published 2007-11-08 22:51 UTC
rendered paste body
;MP3 Player v1.3 Written by Clipso
;Added a scroll bar at the bottom to show the position of the song
;The scroll bar can be moved to scroll through the song
;Installation:
;copy everything you see here
;go to mIRC
;press alt + r
;paste in the script editor that opens
;click ok
;right click the active chat window and select MP3 Player, OR press the F2 Key
;Enjoy!

menu * {
  MP3 Player:dialog -md mp3 mp3
}
dialog -l mp3 {
  title "MP3 player, v1.4, Written by Clipso"
  option dbu
  size -1 -1 240 185
  menu "Stuff" 1
  item "Information" 2
  item "Select a new music directory" 23
  item "Help" 22
  list 3, 1 0 90 85, vsbar sort
  list 6, 148 0 90 85, vsbar
  list 12, 1 93 90 85, vsbar
  button "Play" 4, 93 54 25 20
  button "Stop" 5, 120 54 25 20
  button "Add to Playlist" 7, 93 0 54 15
  button "Remove from playlist" 8, 93 18 54 15
  button "Clear Playlist" 9, 93 36 54 15
  button "Volume +" 17, 93 77 53 10
  button "Volume -" 18, 93 97 53 10
  button "Skip Song" 20, 180 102 53 10
  button "Previous Song" 21, 180 112 53 10
  button "Fix check boxes", 27, 93 110 53 15
  edit "" 19, 110 87 17 10, center
  edit "Search for a song" 10, 1 82 90 10
  check "Shuffle Playlist" 13, 148 92 85 10
  check "Automatically play next song" 14, 148 82 85 10
  check "Mute" 15, 148 102 30 10
  check "Pause" 16, 148 112 30 10
  combo 24, 148 130 50 10, drop
  scroll "", 28, 58 182 120 1, horizontal range 1 1000
  text "Inform style" 25, 148 122 30 7
  text "The inform style is where you want your Now Playing messages to show up. (Some messages are locked on Echo)" 26, 147 142 93 33
  text "00:00", 29, 4 176 53 7, right
  text "00:00", 30, 180 176 103 7
  edit "", 31, 93 130 53 10, right autohs
  edit "", 32, 93 143 53 10, autohs
}
dialog -l MP3Progress { 
  title "MP3 Player, Loading..."
  size -1 -1 100 64
  option dbu
  text "", 1, 1 1 100 37
  text "", 2, 25 25 50 7
}
alias F2 { dialog -md mp3 mp3 }
alias -l MVer { return v1.4 }
alias -l MP3Colors { return %MP3LM $+  $+ $1- $+  $+ %MP3RM }
alias -l GetSongs { if (%songdir != $null) { var %a = 0, %b = 1, %c = 0 | while (%a <= $nopath($findfile(%songdir,*.mp3,0))) { inc %a | did -a mp3 3 $remove($nopath($findfile(%Songdir,*.mp3,%a)),.mp3) | $MP3Progress } | while ($read(playlist.txt,%b) != $null) { did -a mp3 6 $read(playlist.txt,%b) | $MP3Progress | inc %b } | if ($did(mp3,3,1).text == $null) { did -d mp3 3 1 } } }
alias -l Playsong { if ($did(mp3,3).seltext != $null) { .splay -p %Songdir $+ $did(mp3,3).seltext $+ .mp3 } | if ($did(mp3,6).seltext != $null) { .splay -p %Songdir $+ $did(mp3,6).seltext $+ .mp3 } | if ($did(mp3,12).seltext != $null) { .splay -p %Songdir $+ $did(mp3,12).seltext $+ .mp3 } | $Playinfo } | did -o MP3 30 1 $remove($duration($calc($Insong.length /1000),3),00:) | $scroll }
alias -l PlaylistAdd { if ($did(mp3,3).seltext != $null) { write playlist.txt $did(mp3,3).seltext | did -a mp3 6 $did(mp3,3).seltext } | if ($did(mp3,12).seltext != $null) { write playlist.txt $did(mp3,12).seltext | did -a mp3 6 $did(mp3,12).seltext } }
alias -l PlaylistDel { if ($did(mp3,6).seltext != $null) { var %a = 1 | while ($read(playlist.txt,%a) != $Null) { if ($did(mp3,6).seltext == $read(playlist.txt,%a)) { write -dl $+ %a playlist.txt | did -d mp3 6 $did(mp3,6).sel } | inc %a } } }
alias -l Listfilter { if ($did(mp3,10,1).text != $null) { did -r mp3 12 | var %a = 0 | While (%a <= $did(mp3,3).lines) { if ($did(mp3,10,1).text isin $did(mp3,3,%a).text) { did -a mp3 12 $did(mp3,3,%a).text } | inc %a } } }
alias -l Deselect { if ($did == 3) { did -u mp3 6,12 } | if ($did == 6) { did -u mp3 3,12 } | if ($did == 12) { did -u mp3 3,6 } }
alias -l Stopplay { if ($insong.fname == $null) { echo -a $MP3Colors(No song is currently playing) | halt } | else { $infostyle $MP3Colors(Stopped playing $songname) | .splay -p stop } }
alias -l Nextsong { if ($lines(playlist.txt) >= 1 && %MP3.Check.14 != $null || $did == 20) { if (%MP3.Check.13 != $null) { .splay -p %songdir $+ $read(playlist.txt,$rand(1,$lines(playlist.txt))) $+ .mp3 } | if ($read(playlist.txt,%PlayNo) == $null) { set %PlayNo 1 } | if (%MP3.Check.13 == $null && $read(playlist.txt,%playno) != $null) { .splay -p %Songdir $+ $read(playlist.txt,%playno) $+ .mp3 } | $Playinfo | did -o MP3 30 1 $duration($calc($insong.length /1000),3) | $Scroll } }
alias -l Songname { var %z = $remove($nopath($insong.fname),.mp3) | return %z }
alias -l Playinfo { if (%Infostyle == off) { halt } | $infostyle $MP3Colors(Now playing) $MP3Colors($remove($nopath($insong.fname),.mp3)) $MP3Colors(Length: $iif($left($duration($calc($insong.length /1000),3),2) == 00,$right($duration($calc($insong.length /1000),3),5),$duration($calc($insong.length /1000),3)) $+ , Bit Rate: $sound($insong.fname).bitrate $+ kbps) }
alias -l Startup { if (%MP3.Check.13 != $null) { did -c mp3 13 } | if (%MP3.Check.14 != $null) { did -c mp3 14 } | if (%MP3.Check.15 != $null) { did -c mp3 15 } | if (%MP3.Check.16 != $null) { did -c mp3 16 } | did -a mp3 19 $round($calc($vol(wave) /655.35),0) | did -a mp3 24 Echo | did -a mp3 24 All Channels | did -a mp3 24 Active Window | did -a mp3 24 Off | var %Chan = 1 | if (!%MP3RM) { set %MP3RM 5:. | set %MP3LM 5.:4 } | did -a MP3 31 %MP3LM | did -a MP3 32 %MP3RM | while ($Chan(%Chan)) { did -a mp3 24 $Chan(%Chan) | inc %Chan } | unset %C | unset %D | dialog -x MP3Progress }
alias -l Mute { if ($insong.fname == $null) { echo -a $MP3Colors(No song is currently playing) | did -u mp3 15 | halt } | if (%MP3.Check.15 != $null) { vol -w %oldvol | unset %oldvol } | if (%MP3.Check.15 == $null) { set %oldvol $vol(wave) | vol -w 0  } }
alias -l Pause { if ($insong.fname == $null) { echo -a $MP3Colors(No song is currently playing) | did -u mp3 16 | halt } | if (%MP3.Check.16 == $null) { .splay -p pause | .timerscroll off } | if (%MP3.Check.16 != $null) { .splay -p resume | .timerscroll 0 1 scroll } }
alias -l Volup { if ($vol(wave) == 65535) { echo -a $MP3Colors(Volume is already 100) | halt } | if ($vol(wave) < 65535) { vol -w $calc($vol(wave) + 655.35) | did -o mp3 19 1 $round($calc($vol(wave) /655.35),0) | halt } }
alias -l Voldown { if ($vol(wave) == 0) { echo -a $MP3Colors(Volume is already at 0) | halt } | if ($vol(wave) > 0) { vol -w $calc($vol(wave) - 655.35) | did -o mp3 19 1 $round($calc($vol(wave) /655.35),0) | halt } }
alias -l Volchange { if ($did(mp3,19) > 100) { echo -a $MP3Colors(100 is the max volume) | did -o mp3 19 1 100 | vol -w 65535 | halt } | if ($did(mp3,19) < 0) { echo -a $MP3Colors(0 is the lowest volume) | did -o mp3 19 1 0 | vol -w 0 | halt } | vol -w $round($calc(655.35 * $did(mp3,19)),0) }
alias -l Prevsong { if ($lines(playlist.txt) >= 1) { if (%MP3.Check.13 != $null) { .splay -p %songdir $+ $read(playlist.txt,$rand(1,$lines(playlist.txt))) $+ .mp3  } | if (%PlayNo == 0) { set %PlayNo $Lines(Playlist.txt) } | if ($read(playlist.txt,%PlayNo) == $null) { set %PlayNo 1 } | if (%MP3.Check.13 == $null && $read(playlist.txt,%playno) != $null) { .splay -p %Songdir $+ $read(playlist.txt,%playno) $+ .mp3 } | $Playinfo | did -o MP3 30 1 $duration($calc($insong.length /1000),3) | $Scroll } }
alias -l Infostyle { if (%Infostyle == msg active && $active != Status Window) { return msg $active } | if ($active == Status Window) { return echo -a } | if (%infostyle == off) { return ; } | if (%infostyle == amsg) { return amsg } | if (%Infostyle == echo -a) { return echo -a } | else { return msg %infostyle } }
alias -l MP3Progress { var %a = $did(mp3,3).lines, %b = $did(mp3,6).lines | if (%c == $null) { set %c $lines(playlist.txt) | set %d $nopath($findfile(%Songdir,*.mp3,0)) } | did -ra MP3Progress 2 Loaded: $int($Calc(( %a + %b ) / ( %c + %d ) * 100)) $+ $Chr(37) }
alias -l Scroll { did -c MP3 28 $Calc($insong.pos / $insong.length *1000) | did -o MP3 29 1 $iif($left($duration($calc($insong.length /1000),3),2) == 00,$right($duration($calc($insong.pos /1000),3),5),$duration($calc($insong.pos /1000),3)) }
on 1:dialog:mp3:menu:23: set %Songdir $sdir(C:\,Select your music folder) | did -r mp3 3 | $getsongs
on 1:dialog:mp3:menu:2: echo -a 10This mp3 player was written by Clipso. Feel free to contact me on irc.swiftirc.net or irc.dcloneirc.net if you need help, or have found a glitch.  This is $MVer of this mp3 player. | echo -a 10Enjoy!
on 1:dialog:mp3:menu:22: echo -a 10In order for this MP3 player to work, you must tell it where your music is, this can be done by going to File -> Select new music directory. | echo -a 10You can quickly open this mp3 player by pressing the F2 key (Assuming your F2 key doesn't do anything already) | echo -a 10The fix check boxes button is what you should use if your check boxes break, rare, but it happens. (Maybe your song is paused when the Pause is unchecked) | if ($version == 6.21) { echo -a 4It seems you are using mIRC v6.21, This script will work however the pause button will not work properly. This is a glitch exclusive to mIRC v6.21 and works fine in other versions of mIRC. } | if ($Version < 6.17) { echo -a 4This script has not been tested on an mIRC client earlier than 6.17. If errors occur please try updating your mIRC client at www.mIRC.com }
on 1:dialog:mp3:init:*: if (%Songdir == $null) { set %Songdir $sdir(C:\,Select your music folder) } | dialog -mdo MP3Progress MP3Progress | did -ra MP3Progress 1 This progress box is just to let you know how much of the mp3 player has been loaded. | did -ra MP3Progress 2 Loaded: 0 $+ $chr(37) | $GetSongs $startup | did -o MP3 30 1 $duration($calc($insong.length /1000),3) | .timerscroll 0 1 /Scroll | /scroll | if (!%Infostyle) { set %infostyle echo -a }
on 1:dialog:MP3Progress:close:*: unset %c | unset %d
on 1:dialog:mp3:close:*: .timerscroll off
on 1:dialog:mp3:sclick:4: $Playsong
on 1:dialog:mp3:sclick:5: $Stopplay
on 1:dialog:mp3:sclick:7: $PlaylistAdd
on 1:dialog:mp3:sclick:8: $PlaylistDel
on 1:dialog:mp3:sclick:9: if ($?="To clear the playlist click type clear into the box below and hit ok." == Clear) { write -c playlist.txt | did -r mp3 6 }
on 1:dialog:mp3:dclick:3,6,12: $Playsong
on 1:dialog:mp3:sclick:3,6,12: $deselect
on 1:dialog:mp3:sclick:13,14: if (%MP3.Check. [ $+ [ $did ] ] == $null) { set %MP3.Check. [ $+ [ $did ] ] 1 | halt } | if (%MP3.Check. [ $+ [ $did ] ] != $null) { unset %MP3.Check. [ $+ [ $did ] ] }
on 1:dialog:mp3:sclick:15: $mute | if (%MP3.Check.15 == $null) { set %MP3.Check.15 1 | halt } | if (%MP3.Check.15 != $null) { unset %MP3.Check.15 } 
on 1:dialog:mp3:sclick:16: $Pause | if (%MP3.Check.16 == $null) { set %MP3.Check.16 1 | halt } | if (%MP3.Check.16 != $Nulll) { unset %MP3.Check.16 }
on 1:dialog:mp3:sclick:17: $Volup
on 1:dialog:mp3:sclick:18: $Voldown
on 1:dialog:mp3:sclick:20: inc %PlayNo | $nextsong
on 1:dialog:mp3:sclick:21: dec %PlayNo | $PrevSong
on 1:dialog:mp3:edit:10: $listfilter
on 1:dialog:mp3:edit:19: $volchange
on 1:dialog:mp3:edit:31: set %MP3LM $did(MP3,31)
on 1:dialog:mp3:edit:32: set %MP3RM $did(MP3,32)
on 1:dialog:mp3:sclick:24: if ($did(mp3,24) == Echo) { set %infostyle echo -a | halt } | if ($did(mp3,24) == All Channels) { set %infostyle amsg | halt } | if ($did(mp3,24) == Active Window) { set %infostyle msg active | halt } | if ($did(mp3,24) == Off) { set %infostyle off | halt } | else { set %Infostyle $did(mp3,24) }
on 1:dialog:mp3:sclick:27: unset %MP3.Check.* | did -u mp3 13,14,15,16 | if ($insong.fname != $null) { .splay -p resume | vol -w %oldvol }
on 1:dialog:mp3:scroll:28: .splay -p seek $int($Calc($insong.length / 1000 * $did(mp3,28).sel))
on 1:mp3end: inc %PlayNo | $Nextsong