mcWin Media Player — File Browser

mcWinMediaPlayerv1.4 / mcWinMediaPlayerv1.4 / mcwinmediaplayer / mcMP.mrc

mcMP.mrc — 22.57 KB — Download this file

; _-==-_-==-_-==-_-==-_-==-_-==-_-==-_-==-_
; mcWIn Media Player v1.4
; Author: mc_twistah
; web: http://www.manowarscript.tk
; e-mail: mctwistah@engineer.com
; _-==-_-==-_-==-_-==-_-==-_-==-_-==-_-==-_

on *:load: { 
  if ($version >= 6.14) {
    linesep -a
    echo 4 -a  mcWIn Media Player v1.4 had been loaded.
    echo 4 -a Author: mc_twistah
    echo 4 -a In case of bugs please e-mail me at mctwistah@engineer.com
    echo 4 -a http://www.manowarscript.tk
    linesep -a
    set %mtdialog -1
    set %msg.mwfile 3
    mwplayer
  }
  else {
    echo -a Sorry but you can not use this addon in $version $+ . Please download the latest mirc at http://www.mirc.com
    echo -a Unloading addon in 2 secs...
    .timer 1 2 .unload -rs $shortfn($scriptdirmcMP.mrc)
  }
}

on *:unload: {
  mw.cls
  if ($dialog(mediaplyl)) { dialog -x mediaplyl }
  if ($dialog(mediaplyr)) { dialog -c mediaplyr }
  unset %mtdialog %mwlistdesk %mpdir %msg.mwfile
}

alias mwplayer if (!$dialog(mediaplyr)) dialog -m $+ $1 mediaplyr mediaplyr

dialog mediaplyr {
  title "mcWin Media Player v1.4 [/mwplayer]"
  size -1 -1 350 300
  icon $shortfn($scriptdiricons\mediaplayer.icl), 1
  text "", 1,1 0 345 300
  list 2,0 1 1 25
  menu "&File", 3 3
  item "&Open file", 4, 3
  item "Add &file", 5, 3
  item break, 6, 3
  item "&Set dir...", 7, 3
  item "&Add dir...", 8, 3
  item break, 9, 3
  item "E&xit", 10, 3
  menu "&Options", 11 11
  menu "&Playlist", 12, 11
  item break, 13, 11
  item "Open in &desktop", 14, 12
  item "Open in &mIRC", 15, 12 
  item "&Clear Playlist", 16, 11
  item break, 26, 11
  item "&Adjust Volume", 27, 11
  item break, 17, 12
  menu "&Transparency", 18, 12
  item "none", 19, 18
  item "10", 20, 18
  item "20", 21, 18
  item "30", 22, 18
  item "40", 23, 18
  item "50", 24, 18
  item "60", 25, 18
  item "70", 28, 18
  item "80", 29, 18
  item "90", 30, 18
  item "100", 31, 18 
  menu "&Help", 32 32 
  item "&Help", 33, 32
  item "&ReadMe", 34, 32
  item break, 35, 32
  item "&E-mail", 36, 32 
  item "&Website", 37, 32
  button "positioner", 38,0 0 0 0
}

alias -l mwlist if (!$dialog(mediaplyl)) dialog -mo $+ $1 mediaplyl mediaplyl

dialog mediaplyl {
  title "mcWin Media Player v1.4 - Playlist [/mwlist]"
  size 0 0 270 300
  icon $shortfn($scriptdiricons\mediaplayer.icl), 2
  list 1,0 25 270 300, size
  menu "&File", 2 2 
  item "Add &file", 3, 2
  item break, 4, 2
  item "&Set dir...", 5, 2
  item "&Add dir..", 6, 2
  item break, 7, 2
  item "E&xit", 8, 2
  menu "&Options", 9 9
  item "&Clear Playlist", 10, 9
  item break, 11, 9
  item "Convert to &HTML", 12, 9
  item "&View HTML Playlist", 13, 9
  item "&DCC HTML Playlist", 14, 9
  item break, 15, 9
  item "D&el HTML Playlist", 16, 9
  item break, 17, 9
  menu "&Spam Option", 18, 9
  item &active, 19, 18
  item /a&msg, 20, 18
  item &none, 21, 18 
  item break, 28, 9
  item "&Adjust Volume", 29, 9
  button "positioner", 22,0 0 0 0
  button "play", 23, 0 0 0 0, hide default
  button "9", 24, 75 0 25 20
  button "4", 25, 105 0 25 20
  button "<", 26, 135 0 25 20
  button ":", 27, 165 0 25 20 
}

on *:dialog:mediaplyl:*:*:{
  if ($devent == init) {
    setmdx
    dll $dll.path(mdx) SetControlMDX 1 ListView headerdrag report rowselect showsel single > $views
    did -i $dname 1 1 headerdims 185:1 60:2
    did -i $dname 1 1 headertext Media File(s): $chr(9) Size(s): $chr(9)
    did -i $dname 1 1 setbkg color $rgb(0,0,0)
    did -i $dname 1 1 settxt color $rgb(225,225,225)
    did -i $dname 1 1 settxt bgcolor $rgb(0,0,0)
    dll $dll.path(mdx) SetControlMDX $dname 22 positioner minbox size > $dialogs
    dll $dll.path(mdx) SetBorderStyle 24,25,26,27 staticedge
    dll $dll.path(mdx) SetFont $dname 24,25,26,27 20 100 webdings
    dll $dll.path(tdialog) TDDialog $dialog($dname).hwnd > %mtdialog
    if (%msg.mwfile == 1) { did -c $dname 19 | did -u $dname 20 | did -u $dname 21 }
    elseif (%msg.mwfile == 2) { did -u $dname 19 | did -c $dname 20 | did -u $dname 21 }
    elseif (%msg.mwfile == 3) { did -u $dname 19 | did -u $dname 20 | did -c $dname 21 } 
    if ($exists($shortfn($scriptdirmediaplaylist.html))) {
      did -e $dname 13 
      did -e $dname 14 
      did -e $dname 16
    } 
    else { 
      did -b $dname 13 
      did -b $dname 14 
      did -b $dname 16
    }
    MediaPlist
  }
  if ($devent == sclick) { 
    if ($did == 1) {
      if ($gettok($did($dname,1,1),1,32) != rclick) halt
      dll $dll.path(popup) New media 16 16
      dll $dll.path(popup) LoadImg media icon small 3, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 4, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 5, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) LoadImg media icon small 6, $+ $shortfn($scriptdiricons\mediaplayer.icl)
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 1 1 &Play $cr popplay
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 2 2 &Add $cr add.mwfile
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 3 3 &Del $cr del.mwfile
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end $iif($did(1).sel != $null,+,+d) 4 4 &Send $cr send.mwfile
      pop media $mouse.dx $mouse.dy
    }
    if ($did == 22) {
      ;permission granted resizable dialog taken from hIRC script 1.7 by da^hype
      var %action = $gettok($did($dname,22),1,32)
      if (%action == size) {
        var %w = $dialog($dname).cw,%h = $dialog($dname).ch
        dll $dll.path(mdx) MoveControl $dname 1 * * $calc(%w - 2) $calc(%h - 26) 
      }
    }
    if ($did == 23) && ($did($dname,1).sel) { popplay }
    if ($did == 24) { prev.file }
    if ($did == 25) && ($did($dname,1).sel) { popplay }
    if ($did == 26) { stoplay }
    if ($did == 27) { next.file }
  }
  if ($devent == menu) {
    if ($did == 3) { add.mwfile }
    if ($did == 5) { set.mwdir }
    if ($did == 6) { add.mwdir }
    if ($did == 8) { dialog -c $dname }
    if ($did == 10) { mw.cls }
    if ($did == 12) { 
      set %convert2html 1
      MediaPlist
      did -e $dname 13 | did -e $dname 14 | did -e $dname 16
    }
    if ($did == 13) { 
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        run $shortfn($scriptdirmediaplaylist.html)
      }
    }
    if ($did == 14) {
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        dcc send $$?="Enter nick to send HTML Playlist:" $shortfn($scriptdirmediaplaylist.html)
      }
    }
    if ($did == 16) {
      if ($exists($shortfn($scriptdirmediaplaylist.html))) {
        if ( $+ $input(Are you sure you want to delete your HTML Playlist?,200,.::ADVISORY::.) == $true) {
          .remove $shortfn($scriptdirmediaplaylist.html)
          did -b $dname 13 | did -b $dname 14 | did -b $dname 16
        }
      }
    }
    if ($did == 19) {
      set %msg.mwfile 1 
      did -c $dname 19
      did -u $dname 20
      did -u $dname 21
    }
    if ($did == 20) {
      set %msg.mwfile 2
      did -u $dname 19
      did -c $dname 20
      did -u $dname 21
    }
    if ($did == 21) {
      set %msg.mwfile 3
      did -u $dname 19
      did -u $dname 20
      did -c $dname 21
    }
    if ($did == 29) { run sndvol32.exe }
  }
  if ($devent == dclick) { 
    if ($did == 1) { 
      popplay
    }
  }
}

on *:dialog:mediaplyr:*:*:{
  if ($devent == init) {
    setmdx
    dll $dll.path(mdx) SetControlMDX $dname 38 positioner maxbox minbox size > $dialogs
    sc_start $dname 2 270 l 70 .::Welcome to mcWIn Media Player v1.4::.
    dll $dll.path(mdx) SetColor $dname 1 background $rgb(0,0,0)
    dll $dll.path(mdx) SetBorderStyle 2
    dll $dll.path(mdx) SetColor $dname 2 background $rgb(face)
    dll $dll.path(mdx) SetColor $dname 2 textbg $rgb(face)
    dll $dll.path(mdx) SetColor $dname 2 text $rgb(0,0,0)
  }
  if ($devent == sclick) {
    if ($did == 38) {
      ;permission granted resizable dialog taken from hIRC script 1.7 by da^hype
      var %action = $gettok($did($dname,38),1,32)
      if (%action == size) {
        var %w = $dialog($dname).cw,%h = $dialog($dname).ch
        dll $dll.path(mdx) MoveControl $dname 1 * * $calc(%w - 2) $calc(%h - 27) 
        dll $dll.path(mdx) MoveControl $dname 2 * $calc(%h - 19)  %w *
      }
    }
  }
  if ($devent == menu) {
    if ($did == 4) {
      if (!$isdir(%mpdir)) { set %mpdir C:\ }
      var %wmp $sfile( $+ %mpdir $+ ,Select a media file to play:,Play)
      if (%wmp != $null) { 
        set %mpdir $nofile(%wmp)
        write -c $shortfn($scriptdirmcMP.htm)
        writeparams 
        write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn(%wmp) $+ ">
        write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
        sc_start $dname 2 270 l 70 Filename: $nopath(%wmp) - Size: ( $+ $bytes($file($shortfn(%wmp)).size).suf $+ ) - Location: ( $+ $nofile(%wmp) $+ )
        var %hwnd = $dll($dll.path(html),item,$dialog($dname).hwnd id:1)
        var %v = $dll($dll.path(html),attach,%hwnd)
        dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
        msg.file
      }
      else { halt }
    }
    if ($did == 5) { add.mwfile }
    if ($did == 7) { set.mwdir }
    if ($did == 8) { add.mwdir }
    if ($did == 10) { dialog -c $dname }
    if ($did == 14) { mwlist d | set %mwlistdesk 1 }
    if ($did == 15) { mwlist | unset %mwlistdesk }
    if ($did == 16) { mw.cls }
    if ($did == 19) { set %mtdialog -1 | res.list }
    if ($did == 20) { set %mtdialog 10 | res.list }
    if ($did == 21) { set %mtdialog 20 | res.list }
    if ($did == 22) { set %mtdialog 30 | res.list }
    if ($did == 23) { set %mtdialog 40 | res.list }
    if ($did == 24) { set %mtdialog 50 | res.list }
    if ($did == 25) { set %mtdialog 60 | res.list }
    if ($did == 28) { set %mtdialog 70 | res.list }
    if ($did == 29) { set %mtdialog 80 | res.list }
    if ($did == 30) { set %mtdialog 90 | res.list }
    if ($did == 31) { set %mtdialog 100 | res.list }
    if ($did == 33) { run $shortfn($scriptdirhelp.htm) }
    if ($did == 34) { run $shortfn($scriptdirreadme.txt) }
    if ($did == 36) { run mailto:mctwistah@engineer.com?subject=mcWin Media Player v1.4 } 
    if ($did == 37) { run http://www.manowarscript.tk }
    if ($did == 27) { run sndvol32.exe }
  }
  if ($devent == close) {
    write -c $shortfn($scriptdirmcMP.htm) | write $shortfn($scriptdirmcMP.htm) <body bgcolor="#000000" topmargin="0" leftmargin="0"></body> 
    var %hwnd = $dll($dll.path(html),item,$dialog($dname).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    $+(.timersc_,$dname,*) off
  }
}

alias -l res.list { 
  if ($dialog(mediaplyl)) { dialog -x mediaplyl } 
  if (%mwlistdesk == 1) { mwlist d } | else { mwlist }
}


alias -l mw.cls { 
  if ($exists($shortfn($scriptdirmediaplaylist.html))) { 
    if ( $+ $input(Do you also want to delete your HTML Playlist?,200,.::ADVISORY::.) == $true) {
      .remove $shortfn($scriptdirmediaplaylist.html)
      if ($dialog(mediaplyl)) {
        did -b mediaplyl 13
        did -b mediaplyl 14 
        did -b mediaplyl 16
      }
    }
  }
  write -c $shortfn($scriptdirmcMP.dat) 
  if ($dialog(mediaplyl)) did -r mediaplyl 1
  unset %wmp.no
}

alias -l add.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto adddir }
  else {
    :adddir
    set %mpdir $$sdir( $+ %mpdir $+ ,Select a media directory to add)
    if (%mpdir != $null) {
      find.file
      mwlist
      MediaPlist
    }
  }
}

alias -l set.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto setdir }
  else {
    :setdir
    set %mpdir $$sdir( $+ %mpdir $+ ,Select a media directory)
    if (%mpdir != $null) {
      write -c $shortfn($scriptdirmcMP.dat)
      find.file
      mwlist
      MediaPlist
    }
  }
}

alias -l add.mwfile {
  if (!$isdir(%mpdir)) { set %mpdir C:\ }
  var %wmp $sfile( $+ %mpdir $+ ,Select a media file to add:,Add)
  if (%wmp != $null) {
    set %mpdir $nofile(%wmp)
    write $shortfn($scriptdirmcMP.dat) %wmp
    mwlist
    MediaPlist
  }
  else { halt }
}

alias -l del.mwfile {  
  if ($did(mediaplyl,1).sel == $null) {
    halt
  }
  else {
    var %mfile $did(mediaplyl,1).sel
    if (%mfile == %wmp.no) { dialog -c mediaplyr }
    write -dl $+ $calc(%mfile - 1) $shortfn($scriptdirmcMP.dat)
    MediaPlist
    if (%mfile < %wmp.no) {
      set %wmp.no $calc(%wmp.no -1)
      did -c mediaplyl 1 %wmp.no
    } 
  }
}

alias -l send.mwfile {
  var %wmp.no $did(mediaplyl,1).sel
  dcc send $$?="Enter nick to send Media file:" $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1)))
}

alias -l stoplay {
  write -c $shortfn($scriptdirmcMP.htm) | write $shortfn($scriptdirmcMP.htm) <body bgcolor="#000000" topmargin="0" leftmargin="0"></body> 
  var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
  var %v = $dll($dll.path(html),attach,%hwnd)
  dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
  $+(.timersc_,mediaplyr,*) off
  sc_start mediaplyr 2 270 l 70 .::Welcome to mcWIn Media Player v1.4::.
}

alias -l popplay {
  if (!$dialog(mediaplyr)) mwplayer
  write -c $shortfn($scriptdirmcMP.htm)
  set %wmp.no $did(mediaplyl,1).sel
  writeparams 
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) $+ $+ ">
  write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
  sc_start mediaplyr 2 270 l 70 Filename: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) - Size: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) - Location: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) $+ ) 
  var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
  var %v = $dll($dll.path(html),attach,%hwnd)
  dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
  msg.file
}

alias -l prev.file {
  var %prev.mp3 $calc($calc(%wmp.no - %wmp.no) +1)
  if ($calc(%wmp.no -1) <= %prev.mp3) || ($did(mediaplyl,1).sel == $null) {
    halt
  }
  else { 
    if (!$dialog(mediaplyr)) mwplayer 
    set %wmp.no $calc(%wmp.no - 1) 
    did -c mediaplyl 1 %wmp.no
    write -c $shortfn($scriptdirmcMP.htm)
    writeparams 
    write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ">
    write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
    sc_start mediaplyr 2 270 l 70 Filename: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) - Size: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))).size).suf $+ ) - Location: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ) 
    var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    msg.file
  }
}

alias -l next.file {
  if ($did(mediaplyl,1).lines == %wmp.no) || ($did(mediaplyl,1).sel == $null) {
    halt
  } 
  else {  
    if (!$dialog(mediaplyr)) mwplayer 
    set %wmp.no $calc(%wmp.no +1)
    did -c mediaplyl 1 %wmp.no
    write -c $shortfn($scriptdirmcMP.htm)
    writeparams 
    write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FileName" VALUE=" $+ $shortfn($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ">
    write $shortfn($scriptdirmcMP.htm) </OBJECT> </body> </html>
    sc_start mediaplyr 2 270 l 70 Filename: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) - Size: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))).size).suf $+ ) - Location: ( $+ $nofile($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no -1))) $+ ) 
    var %hwnd = $dll($dll.path(html),item,$dialog(mediaplyr).hwnd id:1)
    var %v = $dll($dll.path(html),attach,%hwnd)
    dll $dll.path(html) navigate $shortfn($scriptdirmcMP.htm)
    msg.file
  }
}

alias -l msg.file {
  if ($status == connected) {
    if (%msg.mwfile == 1) {
      .msg $color(info) -a .::mcWin Media Player v1.4 :: Playing: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) :: Size: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) $+ ::.
    }
    elseif (%msg.mwfile == 2) {
      .amsg $color(info) .::mcWin Media Player v1.4 :: Playing: $nopath($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))) :: Size: ( $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),$calc(%wmp.no - 1))).size).suf $+ ) $+ ::.
    }
  }
}

alias -l MediaPlist { 
  did -r  mediaplyl 1
  if (%convert2html == 1) {
    write -c $shortfn($scriptdirmediaplaylist.html)
    write $shortfn($scriptdirmediaplaylist.html) <title>HTML Playlist - mcWin Media Player v1.4</title>
    write $shortfn($scriptdirmediaplaylist.html) <body background=" $+ $scriptdiricons/bg.gif $+ " text="#000000">
    write $shortfn($scriptdirmediaplaylist.html) <center><font face="tahoma" size="2pt"><b>HTML Playlist - mcWin Media Player v1.4 $+ <br>
    if ($me == $null) { write $shortfn($scriptdirmediaplaylist.html) Generated by:</b> no nick $+ <br> } | else { write $shortfn($scriptdirmediaplaylist.html) Generated by:</b> $me $+ <br> }
    write $shortfn($scriptdirmediaplaylist.html) <b>Date:</b> $date(mmmm d) $+ , $date(yyyy) <b>Time:</b> $time(hh:nn:ss tt) $+ </center><br>
    write $shortfn($scriptdirmediaplaylist.html) <ol>
  }
  var %x = 1
  while (%x < $calc($lines($shortfn($scriptdirmcMP.dat)) + 1)) {
    did -a mediaplyl 1 $remove($nopath($read($shortfn($scriptdirmcMP.dat),%x)),.mpg ,.mpeg ,.avi ,.asf ,.mov ,.wmv ,.mp3 ,.mp4 ,.swf $+ ) $chr(9) $bytes($file($read($shortfn($scriptdirmcMP.dat),%x)).size).suf
    if (%convert2html == 1) {
      write $shortfn($scriptdirmediaplaylist.html) <li>Filename: <b><u> $+ $nopath($read($shortfn($scriptdirmcMP.dat),%x)) $+ </u></b> <b>-</b> Size: <b><u> $+ $bytes($file($read($shortfn($scriptdirmcMP.dat),%x)).size).suf $+ </u></b> <b>-</b> Location: <b><u> $+ $nofile($read($shortfn($scriptdirmcMP.dat),%x)) $+ </u></b></li>
    }    
    inc %x
  }
  if ($exists($shortfn($scriptdirmediaplaylist.html))) && (%convert2html == 1) {
    run $shortfn($scriptdirmediaplaylist.html)
  } 
  unset %convert2html
  did -c mediaplyl 1 %wmp.no
}

alias -l find.file {
  var %x = $findfile(%mpdir,*.swf,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.avi,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wmv,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.asf,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wma,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mpeg,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mpg,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mp3,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.mid,0,write $shortfn($scriptdirmcMP.dat) $1-)
  var %x = $findfile(%mpdir,*.wav,0,write $shortfn($scriptdirmcMP.dat) $1-)
}

alias -l writeparams {
  write $shortfn($scriptdirmcMP.htm) <html> <head> <title>mcWin Media Player v1.4</title> </head>
  write $shortfn($scriptdirmcMP.htm) <body topmargin="0" leftmargin="0">
  write $shortfn($scriptdirmcMP.htm) <OBJECT classid="CLSID:05589FA1-C356-11CE-BF01-00AA0055595A" height="100%" id="mcWinMediaPlayer" style="LEFT: 0px; TOP: 0px"  width="100%" VIEWASTEXT>
  ;1 to show controls and 0 to hide controls (play, pause, stop etc...)  
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="ShowControls" VALUE="1">
  ;1 to show trackbar and 0 to hide trackbar
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="ShowTracker" VALUE="1">
  ;1 to enable trackbar 0 to disable trackbar (responsible for seeking option)
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="EnableTracker" VALUE="1">
  ;1 to enable fullscreen and 0 to disable fullscreen
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="FullScreenMode" VALUE="1">
  ;1 to enable auto start and 0 to disable auto start
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="AutoStart" VALUE="1">
  ;1 to enable auto rewind and 0 to disable auto rewind (needed for the trackbar/music to go back to its initial position)
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="AutoRewind" VALUE="1">
  ;1 to enable controls and 0 to disable controls (responsible for accessing the controls)
  write $shortfn($scriptdirmcMP.htm) <PARAM NAME="Enabled" VALUE="1">
}

;Scrolling text snippet by Sigh_ 

alias -l sc_start {
  var %r return,%e echo $color(info) -ea * /sc_start:,%c did -r $1-2
  if $isid { %e incorrect usage | %r }
  if !$5 { %e insufficient parameters | %r }
  if !$dialog($1) { %e no such dialog | %r }
  if $4 != l && $4 != r { %e invalid direction | %r }
  var %x $timer(0)
  while %x { 
    if $+(sc_,$1,_,$2,_*) iswm $timer(%x) { .timer $+ $ifmatch off | %c | break }
    dec %x
  }
  var %a did -a $1-2,%n $+($iif($4 = l,$6-),$chr(160),$iif($3 > $len($6-),$str($chr(160),$calc($3 - $len($6-)))),$iif($4 = r,$6-)),%x 1
  %a %n
  while %x <= $len(%n) {
    $+(.timersc_,$1,_,$2,_,%x) -m 1 $calc($5*%x) %c $chr(124) %a $right(%n,$iif($4 = l,-) $+ %x) $+ $left(%n,$iif($4 = r,-) $+ %x) $iif(!$calc($len(%n)-%x),$chr(124) sc_start $1-)
    inc %x
  }
}

alias -l pop tokenize 32 $dll($dll.path(popup),Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)

alias -l dll.path {
  if ($1 == mdx) return $shortfn($scriptdirdlls\mdx\mdx.dll)
  elseif ($1 == html) return $shortfn($scriptdirdlls\nHTMLn\nHTMLn_2.92.dll)
  elseif ($1 == popup) return $shortfn($scriptdirdlls\popups\popups.dll)
  elseif ($1 == tdialog) return $shortfn($scriptdirdlls\tdialog\tdialog.dll)
}

alias -l views return $shortfn($scriptdirdlls\mdx\views.mdx)

alias -l bars return $shortfn($scriptdirdlls\mdx\bars.mdx)

alias -l dialogs return $shortfn($scriptdirdlls\mdx\dialog.mdx)

alias -l setmdx {
  dll $dll.path(mdx) SetMircVersion $version
  dll $dll.path(mdx) MarkDialog $dname $dialog($dname).hwnd
} 

menu menubar {
  -
  mcWin Media Player
  .Main player
  ..Open on &desktop:mwplayer d
  ..Open in &mIRC:mwplayer
  .-
  .Playlist
  ..Open on &desktop:mwlist d | set %mwlistdesk 1
  ..Open in &mIRC:mwlist | unset %mwlistdesk
  .-
  .Unload:if ( $input(Are you sure you want to unload mcWin Media Player v1.4?,200,.::ADVISORY::.) == $true) { echo 4 -a Unloading addon in 2 secs... | .timer 1 2 .unload -rs $shortfn($scriptdirmcMP.mrc) }
  -
}