;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;;;;;;;;;;;;;;; >>>>>>>> Narkoman's Script by [StingeR] ver: 3.5   All Rights Reserved. Copyright Narkoman's™ 2008 <<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ñîçäàòåëü - [StingeR] <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; >>>>>>>>>>>>> Îá îøèáêàõ ïèøèòå íà: StingeRuleZ@mail.ru  <<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;;;;;;;;;; >>>>>>>>>>>>>>>>>>>>> Îôèöèàëüíûé ñàéò ñêðèïòà: http://chan456.ucoz.ru <<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
; _-==-_-==-_-==-_-==-_-==-_-==-_-==-_-==-_
; Narkoman's Audio Player ver. 1.0
; Author: mc_twistah 
; web: http://www.manowarscript.tk
; e-mail: mctwistah@engineer.com or mjtulagan@hotmail.com
; _-==-_-==-_-==-_-==-_-==-_-==-_-==-_-==-_
;Äîðàáîòêà è ïåðåâîä íà ðóññêèé ÿçûê - [StingeR]
;e-mail:  narkoo-master@mail.ru 
;            narkoo-master@maxalina.net
;web:     http://www.narkomans.ucoz.ru
; _-==-_-==-_-==-_-==-_-==-_-==-_-==-_-==-_
on *:load: { 
  if ($version >= 6.14) {
    mctheme
    themez 
  }
}
alias mcmp3 if (!$dialog(mcmp3)) { themez | dialog -m $+ $1 mcmp3 mcmp3 }
dialog mcmp3 {
  title "Narkoman's Audio Player 1.0"
  size -1 -1 450 120
  icon $mcicon, 0
  list 1, 43 10 190 25
  list 2, 240 10 160 93, extsel size
  icon 3, 53 65 24 24,%prevt, noborder
  icon 4, 83 65 24 24,%playt, noborder
  icon 5, 113 65 24 24,%nextt, noborder
  icon 6, 143 65 24 24,%pauset, noborder
  icon 7, 173 65 24 24,%stopt, noborder
  icon 8, 203 65 24 24,%dirt, noborder
  icon 9, 15 87 16 16,%mutet, noborder
  icon 10, 406 18 24 24,%addirt, noborder
  icon 11, 406 48 24 24,%addfilet, noborder
  icon 12, 406 78 24 24,%cleart, noborder
  icon 13, 425 3 8 8,%xt, noborder
  icon 14, 413 3 6 8,%helpt, noborder
  text "êá/ñ", 15, 55 43 50 15
  text "00:00/00:00", 16, 115 43 55 15
  text "êÃö", 17, 188 43 50 15
  list 22, 38 25 200 13, size
  list 23,8 15 30 72, size
  button "", 24, 0 0 0 0 0, default
}
alias -l about { if (!$dialog(about)) dialog -mo about about }
dialog about {
  title "Î Narkoman's Audio Player By [StingeR] 1.0"
  size -1 -1 190 90
  icon 1, 170 3 8 8, $shortfn($scriptdirimages\x.png), noborder
}
on *:dialog:about:*:*: {
  if ($devent == init) {
    dll $dll.path(imgdlg) ImgDlg 1 1 $dialog($dname).hwnd $shortfn($scriptdirimages\about.bmp)
  }
  if ($devent == sclick) { if ($did == 1) dialog -x $dname }
}
alias -l mcProgressbar { if (!$dialog(mcProgressbar)) dialog -m mcProgressbar mcProgressbar }
dialog mcProgressbar {
  title "mcProgressbar"
  size -1 -1 172 50
  text "Çàãðóçêà...", 1, 5 5 165 15
  text "", 2, 5 25 165 15
  text "", 3, 5 45 165 15
}
on *:dialog:mcProgressbar:*:*:{
  if ($devent == init) {
    dll $dll.path(mdx) SetMircVersion $version
    dll $dll.path(mdx) MarkDialog $dname
    dll $dll.path(mdx) SetDialog $dname style border
    dll $dll.path(mdx) SetControlMDX $dname 3 progressbar smooth > $ctl_gen
  }
}
alias -l mcid3 { if (!$dialog(mcid3)) dialog -m mcid3 mcid3 }
dialog mcid3 {
  title "Ðåäàêòîð ID3v1 "
  size -1 -1 280 340
  icon $mcicon, 6
  edit "", 1, 5 5 270 20, autohs read
  box "ID3v1", 2, 5 30 270 142
  text "Ïåñíÿ", 3, 10 53 30 15
  edit "", 4, 65 47 200 22, autohs limit 30
  text "Èñïîëíèòåëü", 5, 10 75 55 15
  edit "", 6, 65 70 200 22, autohs limit 30
  text "Àëüáîì", 7, 10 98 55 15
  edit "", 8, 65 93 200 22, autohs limit 30
  text "Ãîä", 9, 10 122 50 15
  edit "", 10, 65 116 40 22, autohs limit 4
  text "Ñòèëü", 11, 110 122 30 15
  combo 12, 145 117 120 200, drop size
  text "Êîììåíòàðèé", 13, 10 145 55 15
  edit "", 14, 65 140 200 22, autohs limit 30
  box "MPEG èíôî", 15, 5 175 270 135
  text "Ðàçìåð:", 16, 10 195 30 15
  text "", 17, 35 195 75 15
  text "Length:", 18, 10 210 35 15
  text "", 19, 50 210 65 15 
  text "Áèòðåéò:", 20, 10 225 35 15
  text "", 21, 50 225 65 15
  text "Sample:", 22, 10 240 40 15
  text "", 23, 53 240 65 15
  text "Mode:", 24, 10 255 30 15
  text "", 25, 45 255 65 15
  text "CRCs:", 26, 10 270 30 15
  text "", 27, 45 270 65 15
  text "Copyrighted:", 28, 10 285 100 15
  text "", 29, 80 285 20 15
  box "NOTE:", 30, 122 185 148 121
  text "This only changes the ID3v1 Tag but does not change the 'Title' and 'Artist' in the playlist. This does not change the ID3v1 Tag of a filename currently played. Please read help.htm for more info.", 31, 128 200 135 105
  button "&Îáíîâèòü", 32, 115 315 50 22
  button "&Îòìåíà", 33, 170 315 50 22
  button "E&xit", 34, 225 315 50 22, ok
}

on *:dialog:mcid3:*:*:{
  if ($devent == init) {
    dll $dll.path(mdx) SetMircVersion $version
    dll $dll.path(mdx) MarkDialog $dname
    didtok $dname 12 59 Blues;Classic Rock;Country;Dance;Disco;Funk;Grunge;Hip-Hop;Jazz;Metal;New Age;Oldies;Other;Pop;R&B;Rap;Reggae;Rock;Techno;Industrial;Alternative;Ska;Death Metal;Pranks;Soundtrack
    didtok $dname 12 59 Euro-Techno;Ambient;Trip-Hop;Vocal;Jazz+Funk;Fusion;Trance;Classical;Instrumental;Acid;House;Game;Sound Clip;Gospel;Noise;AlternRock;Bass;Soul;Punk;Space;Meditative;Instrumental Pop;Instrumental Rock;Ethnic;Gothic
    didtok $dname 12 59 Darkwave;Techno-Industrial;Electronic;Pop-Folk;Eurodance;Dream;Southern Rock;Comedy;Cult;Gangsta;Top 40;Christian Rap;Pop/Funk;Jungle;Native American;Cabaret;New Wave;Psychedelic;Rave;Showtunes;Trailer;Lo-Fi;Tribal;Acid Punk;Acid Jazz
    didtok $dname 12 59 Polka;Retro;Musical;Rock & Roll;Hard Rock;Folk;Folk/Rock;National Folk;Swing;Fast Fusion;Bebob;Latin;Revival;Celtic;Bluegrass;Avantgarde;Gothic Rock;Progressive Rock;Psychedelic Rock;Symphonic Rock;Slow Rock;Big Band;Chorus;Easy Listening;Acoustic
    didtok $dname 12 59 Humour;Speech;Chanson;Opera;Chamber Music;Sonata;Symphony;Booty Bass;Primus;Porn Groove;Satire;Slow Jam;Club;Tango;Samba;Folklore;Ballad;Power Ballad;Rhythmic Soul;Freestyle;Duet;Punk Rock;Drum Solo;Acapella;Euro-house;Dance hall 
  }
  if ($devent == sclick) {
    if ($did == 32) id3display2 $did($dname,1)
    if ($did == 33) id3display1 $did($dname,1)
  }
}

alias -l thmemanage { if (!$dialog(thmemanage)) dialog -mo thmemanage thmemanage }

dialog thmemanage {
  title "Ìåíåäæåð ñêèíîâ"
  size -1 -1 170 165
  icon $mcicon, 4
  list 1, 7 20 155 110, size autohs
  box "Ñêèíû", 2, 2 2 165 135
  button "Ïðèìåíèòü", 3, 56 140 56 22
  button "", 4, 0 0 0 0, default
  button "Îáíîâèòü", 5, 5 140 50 22
  button "Âûõîä", 6, 115 140 50 22
}

on *:dialog:thmemanage:*:*: {
  if ($devent == init) {
    dll $dll.path(mdx) SetMircVersion $version 
    dll $dll.path(mdx) MarkDialog $dname
    dll $dll.path(mdx) SetControlMDX $dname 1 ListView report rowselect showsel single > $views
    did -i $dname 1 1 headerdims 65:1 70:2
    did -i $dname 1 1 headertext Themes: $chr(9) Authors: $chr(9)
    write -c $scriptdirconfig\themes.dat
    var %x 1
    while ($findfile($scriptdirthemes,*.ini,%x)) {
      var %y $ifmatch
      var %z $nopath($ifmatch)
      write $scriptdirconfig\themes.dat %y
      did -a $dname 1 0 + 0 0 $iif($script(%z),2,1) $readini(%y,colors,name) $+ $chr(9) $+ $readini(%y,colors,author)
      inc %x
    }
    did -c $dname 1 $calc(%thmesel +1)
  }
  if ($devent == sclick) {
    if ($did == 3) || ($did == 4) {
      if ($did,1).sel != $null) {
        getthme
      }
    }
    if ($did == 5) { run http://www.manowarscript.tk }
    if ($did == 6) { dialog -c $dname }
  }
  if ($devent == dclick) {
    if ($did == 1) { getthme } 
  }
}

alias -l getthme { 
  set %thmesel $calc($did($dname,1).sel - 1)
  set %thmedir $remove($read($scriptdirconfig\themes.dat,%thmesel),colors.ini)
  mctheme | if ($dialog(mcmp3)) { dialog -c mcmp3 } | mcmp3
}

alias -l mcsearch { if (!$dialog(mcsearch)) dialog -m mcsearch mcsearch }

dialog mcsearch {
  title "Narkoman's Audio Player 1.0 Ïîèñê ôàéëà"
  size -1 -1 250 200
  icon $mcicon, 5
  edit "", 1, 47 10 115 20, autohs
  icon 2, 165 8 24 24, $shortfn($scriptdirimages\search.png), noborder
  list 3, 6 35 231 145, size
  icon 4, 223 5 8 8, $shortfn($scriptdirimages\x.png), noborder
}

on *:dialog:mcsearch:*:*: {
  if ($devent == init) {
    dll $dll.path(mdx) SetMircVersion $version
    dll $dll.path(mdx) MarkDialog $dname
    dll $dll.path(mdx) SetControlMDX 3 ListView infotip headerdrag report rowselect showsel single > $views
    did -i $dname 3 1 headerdims 214:1  
    did -i $dname 3 1 headertext Result $chr(9)
    did -i $dname 3 1 setbkg color $rgb(227,216,194)
    did -i $dname 3 1 settxt color $rgb(136,136,136)
    did -i $dname 3 1 settxt bgcolor $rgb(227,216,194)
    dll $dll.path(mdx) SetBorderStyle 3
    dll $dll.path(mdx) SetFont $dname 3 -10 400 Tahoma
    dll $dll.path(mdx) SetColor $dname 1 background $rgb(227,216,194)
    dll $dll.path(mdx) SetColor $dname 1 textbg $rgb(227,216,194)
    dll $dll.path(mdx) SetColor $dname 1 text $rgb(136,136,136)
    dll $dll.path(imgdlg) ImgDlg 1 1 $dialog($dname).hwnd $shortfn($scriptdirimages\srcher.bmp)
  }
  if ($devent == sclick) {
    if ($did == 2) { 
      if ($did(mcsearch,1) == $null) { halt } 
      refresh
    }
    if ($did == 3) {
      if ($gettok($did($dname,3,1),1,32) != rclick) halt
      dll $dll.path(popup) New search 16 16
      dll $dll.path(popup) LoadImg search icon small 2, $+ $mcicon
      dll $dll.path(popup) LoadImg search icon small 2, $+ $mcicon
      dll $dll.path(popup) AddItem search end $iif($did(3).sel != $null,+,+d) 1 1 &Äîáàâèòü $cr addtoplyr
      dll $dll.path(popup) AddItem search end
      dll $dll.path(popup) AddItem search end $iif($lines($mcmp1.dat) != 0,+,+d) 2 2 &Äîáàâèòü âñå $cr addalltoplyr
      pop search $mouse.dx $mouse.dy
    }
    if ($did == 4) {
      dialog -x mcsearch
      write -c $mcmp1.dat
      write -c $mcmp2.dat
      write -c $mcmp4.dat
      write -c $mcmp5.dat
    }
  }
  if ($devent == dclick) { addtoplyr }
}

alias -l addtoplyr {
  var %wmp $read($mcmp1.dat, $calc($did(3).sel - 1))
  if (%wmp != $null) {
    set %mpdir $nofile(%wmp)
    write $mcmp.dat %wmp
    write $mcmp3.dat 0 + 0 0 0 $nopath(%wmp)
    loadbuf -ro mcmp3 2 $mcmp3.dat
    if ($dialog(mcmp3)) did -c mcmp3 2 %wmp.no
    set %files.html $lines($mcmp.dat)
  }
  else { halt }
}

alias -l addalltoplyr {
  var %x = 1
  var %y = $calc($lines($mcmp1.dat) + 1)
  while (%x < %y) {
    var %z = $read($mcmp1.dat,%x)
    write $mcmp.dat %z
    write $mcmp3.dat 0 + 0 0 0 $nopath(%z)
    inc %x
  }
  loadbuf -ro mcmp3 2 $mcmp3.dat
  set %files.html $lines($mcmp.dat)
}

alias -l refresh {
  if (%srchdir == $null) { set %srchdir C:\ | goto srchdir }
  else {
    :srchdir
    set %srchdir $$sdir( $+ %srchdir $+ ,Âûáåðèòå ìåäèà äèðåêòîðèÿ äëÿ ïîèñêà)
    if (%srchdir != $null) {
      write -c $mcmp1.dat
      write -c $mcmp2.dat
      write -c $mcmp4.dat
      write -c $mcmp5.dat
      did -r mcsearch 3
      dll $dll.path(listfiles) setoutput <dir><fname>
      dll $dll.path(listfiles) listfiles f > $mcmp2.dat > %srchdir > *.mp3;*.mid;*.wav;*.wma;*.ogg > 0
      dll $dll.path(listfiles) setoutput 0 + 0 0 0 <fname>
      dll $dll.path(listfiles) listfiles f > $mcmp4.dat > %srchdir > *.mp3;*.mid;*.wav;*.wma;*.ogg > 0
    }
  }
  listsearch
}

alias -l listsearch {
  set %wildcard $did(mcsearch,1)
  set %wildcard $replace(%wildcard,$chr(32),$chr(42))
  set %wildcard $chr(42) $+ %wildcard $+ $chr(42)
  :again
  if ( ** isin %wildcard ) {
    set %wildcard $replace(%wildcard,**,*) 
    goto again
  }
  filter -ff $mcmp2.dat $mcmp1.dat %wildcard
  filter -ff $mcmp4.dat $mcmp5.dat %wildcard
  loadbuf -ro mcsearch 3 $mcmp5.dat
  if ($lines($mcmp1.dat) == 0) {
    did -i mcsearch 3 1 headertext Ðåçóëüòàò :: Íè÷åãî íå íàéäåíî $chr(9)
  }
  else { 
    did -i mcsearch 3 1 headertext Ðåçóëüòàò :: íàéäåíî $lines($mcmp1.dat) ôàéëîâ $chr(9)
  }
}

on *:dialog:mcmp3:*:*: {
  if ($devent == init) {
    if ($dialog(mp3dock)) { dialog -c mp3dock }
    dll $dll.path(mdx) SetMircVersion $version
    dll $dll.path(mdx) MarkDialog $dname
    dll $dll.path(mdx) SetControlMDX $dname 22 trackbar noticks tooltips > $bars
    did -i $dname 22 1 params * * * * * * * 10
    dll $dll.path(mdx) SetControlMDX $dname 23 trackbar vertical both tooltips > $bars
    did -i $dname 23 1 params $calc(65535 - $vol(master)) 0 65535 1 10 0 65535 10
    did -i $dname 23 1 ticfreq 6553
    dll $dll.path(mdx) SetControlMDX 2 ListView infotip noheader report rowselect showsel single > $views
    did -i $dname 2 1 headerdims 143:1
    did -i $dname 2 1 headertext Playlist $chr(9)
    did -i $dname 2 1 setbkg color %plbg 
    did -i $dname 2 1 settxt color %pltxt 
    did -i $dname 2 1 settxt bgcolor %pltxtbg 
    dll $dll.path(mdx) SetBorderStyle 1,2,22,23
    dll $dll.path(mdx) SetFont $dname 1,2,15,16,17 -10 400 Tahoma
    dll $dll.path(mdx) SetColor $dname 1,15,16,17,22,23 background %plyrbg 
    dll $dll.path(mdx) SetColor $dname 1,15,16,17 textbg %plyrtxtbg 
    dll $dll.path(mdx) SetColor $dname 1,15,16,17 text %plyrtxt 
    dll $dll.path(imgdlg) ImgDlg 1 1 $dialog($dname).hwnd %maint
    dll $dll.path(tdialog) TDDialog $dialog($dname).hwnd > %mctrans
    if (%vol.mp3 == 1) { vol -vu1 } | else { vol -vu2 } 
    mp3.info   
    loadbuf -ro $dname 2 $mcmp3.dat
    did -c $dname 2 %wmp.no                                  
    .timermp301 0 1 pb.length 
    .timermp302 0 1 cnt.length
    if ($insong) || ($inwave) || ($inmidi) { sc_start $dname 1 100 l 70 $sc.play }
    else { sc_start $dname 1 100 l 70 $sc.welcome }
  }
  if ($devent == sclick) {
    if ($did == 2) {
      if ($gettok($did($dname,2,1),1,32) != rclick) halt
      dll $dll.path(popup) New media 16 16
      dll $dll.path(popup) LoadImg media icon small 1, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 2, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 3, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 4, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 14, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 5, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 6, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 7, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 8, $+ $mcicon
      dll $dll.path(popup) LoadImg media icon small 9, $+ $mcicon
      dll $dll.path(popup) AddItem media end $iif($did(2).sel != $null,+,+d) 1 1 &Èãðàòü $cr popplay
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 2 2 &Äîáàâèòü $cr add.mwfile
      dll $dll.path(popup) AddItem media end $iif($did(2).sel != $null,+,+d) 3 3 &Óäàëèòü $cr del.mwfile
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 4 4 &Òåìû ( $+ %mctheme $+ ) $cr thmemanage
      dll $dll.path(popup) AddItem media end

      ;docking of the mp3 must have a timer with it or mIRC will crash
      dll $dll.path(popup) AddItem media end 5 5 Ð&àñïîëîæåíèå mp3 ( $+ %dock.pos $+ ) $cr .timer 1 1 mp3dock

      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 6 6 Ï&îèñê $cr mcsearch
      dll $dll.path(popup) AddItem media end $iif($did(2).sel != $null,+,+d) 7 7 &ID3 Ðåäàêòîð $cr ID3edit
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 8 8 &Çãðóçèòü *.m3u $cr loadpl.m3u
      dll $dll.path(popup) AddItem media end 9 9 &Ñîõðàíèòü *.m3u $cr savepl.m3u
      dll $dll.path(popup) AddItem media end
      dll $dll.path(popup) AddItem media end 10 10 &Ãåíåðèðîâàòü â html $cr generatehtml
      pop media $mouse.dx $mouse.dy
    }
    if ($did == 3) {
      var %prev.mp3 $calc($calc(%wmp.no - %wmp.no) +1)
      if ($calc(%wmp.no -1) <= %prev.mp3) || ($did($dname,2).sel == $null) {
        halt
      }
      else { 
        .splay stop
        set %wmp.no $calc(%wmp.no - 1) 
        did -c $dname 2 %wmp.no
        .splay $play.file
        mc.msg
        sc_start $dname 1 100 l 70 $sc.play
        unset %pause.mp3
        mp3.info
      }
    }
    if ($did == 4) || ($did == 24) { popplay }
    if ($did == 5) {
      if ($did($dname,2).lines == %wmp.no) || ($did($dname,2).sel == $null) {
        halt
      } 
      else { 
        .splay stop
        set %wmp.no $calc(%wmp.no + 1) 
        did -c $dname 2 %wmp.no
        if ($play.file != $null) { .splay $play.file }
        mc.msg
        sc_start $dname 1 100 l 70 $sc.play
        unset %pause.mp3
        mp3.info
      }
    }
    if ($did == 6) {
      if ($insong) {
        if (%pause.mp3 != 1) { .splay pause | set %pause.mp3 1 }
        else { 
          if (%pause.mp3 == 1) { .splay resume | unset %pause.mp3 }
        }
      }
    }
    if ($did == 7) { mp3stop }
    if ($did == 8) { set.mwdir }
    if ($did == 9) { 
      if (%vol.mp3 != 1) {
        vol -vu1
        set %vol.mp3 1
        did -b $dname 23 
        did -i $dname 23 1 params 65535 * * * * * * 10
      }
      else {
        if (%vol.mp3 == 1) {
          vol -vu2
          unset %vol.mp3
          did -e $dname 23
          did -i $dname 23 1 params $calc(65535 - $vol(master)) 0 65535 1 10 0 65535 10
        }
      }
    }
    if ($did == 10) { add.mwdir }
    if ($did == 11) { add.mwfile }
    if ($did == 12) { mw.cls }
    if ($did == 13) { dialog -c $dname }  
    if ($did == 14) { about }
    if ($did == 22) {  
      did -i $dname 22 1 tipText Âîñïðîèçâåäåíèå: $time($round($calc($insong.pos / 1000)),nn:ss)
      if ($play.file != $null) { .splay seek $gettok($did(22,1),1,32) }
    } 
    if ($did == 23) {
      did -i $dname 23 1 tipText Ãðîìêîñòü: $+($round($calc((65535 - $gettok($did(23,1),1,32)) / 655.35),0),%)
      vol -v $calc(65535 - $gettok($did($dname,23,1),1,32))
    }
  }
  if ($devent == close) {
    $+(.timersc_,$dname,*) off
  }
  if ($devent == dclick) {
    if ($did == 2) { popplay }
  }
}

alias -l mp3dock { if (!$dialog(mp3dock)) dialog -m mp3dock mp3dock }

dialog mp3dock {
  size -1 -1 0 34
  list 1, 6 8 195 24, size
  list 2, 198 13 190 25
  list 3, 390 14 150 13, size
  text "00:00/00:00", 4, 545 12 60 15
  text "êá/ñ", 5, 615 12 50 15
  text "êãö", 6, 670 12 50 15
  text "mode", 7, 725 12 60 15
  text "Ãðîìêîñòü:", 8, 795 12 50 15
  list 9, 835 8 100 20, size
  box "", 10, 5 0  935 32
}

on *:dialog:mp3dock:*:*:{
  if ($devent == init) {
    if ($dialog(mcmp3)) { dialog -c mcmp3 }
    dll $dll.path(mdx) SetMircVersion $version 
    dll $dll.path(mdx) MarkDialog $dname
    dll $dll.path(mdx) SetControlMDX $dname 1 ToolBar list flat wrap nodivider arrows > $bars
    dll $dll.path(mdx) SetControlMDX $dname 3 trackbar noticks tooltips > $bars
    did -i $dname 3 1 params * * * * * * * 10
    dll $dll.path(mdx) SetControlMDX $dname 9 trackbar horizontal NWticks tooltips > $bars
    did -i $dname 9 1 params $vol(master) 0 65535 1 10 0 65535 10
    did -i $dname 9 1 ticfreq 6553
    dll $dll.path(mdx) SetBorderStyle $dname 1,2,3,9
    dll $dll.path(hOS) Dock $dname %dock.pos 0
    did -i $dname 1 1 bmpsize 16 16
    did -i $dname 1 1 setimage +nhd 0 icon small 10, $+ $mcicon
    did -i $dname 1 1 setimage +nhd 0 icon small 1, $+ $mcicon
    did -i $dname 1 1 setimage +nhd 0 icon small 11, $+ $mcicon
    did -i $dname 1 1 setimage +nhd 0 icon small 12, $+ $mcicon
    did -i $dname 1 1 setimage +nhd 0 icon small 13, $+ $mcicon
    did -i $dname 1 1 setimage +nhd 0 icon small 14, $+ $mcicon
    did -a $dname 1 +a 1 $chr(9) Ïðåä. òðåê
    did -a $dname 1 +a 2 $chr(9) Âîñïðîèçâåäåíèå
    did -a $dname 1 +a 3 $chr(9) Ñëåä. òðåê
    did -a $dname 1 +a 4 $chr(9) Ïàóçà
    did -a $dname 1 +a 5 $chr(9) Ñòîï
    did -a $dname 1 -
    did -a $dname 1 +av 6 $chr(9) Îïöèè
    did -a $dname 1 -
    dll $dll.path(mdx) SetFont $dname 2 -10 400 Tahoma
    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 ($insong) || ($inwave) || ($inmidi) { sc_start $dname 2 100 l 70 $mctitle }
    else { sc_start $dname 2 100 l 70 $sc.welcome }
    mp3.info
    .timermp301 0 1 pb.length 
    .timermp302 0 1 cnt.length
  }
  if ($devent == sclick) {
    if ($did == 1) {
      var %a = $did($dname,1).sel
      if (%a == 2) {
        var %prev.mp3 $calc($calc(%wmp.no - %wmp.no) +1)
        if ($calc(%wmp.no -1) <= %prev.mp3) { halt }
        else {
          .splay stop
          set %wmp.no $calc(%wmp.no - 1) 
          .splay $play.file
          mc.msg
          sc_start $dname 2 100 l 70 $mctitle
          unset %pause.mp3
          mp3.info
        }
      }
      elseif (%a == 3) {
        if (%pause.mp3 == 1) { .splay resume | unset %pause.mp3 }
        else {
          if ($lines($mcmp.dat) < 1) { halt }
          elseif ($lines($mcmp.dat) == 1) || ($lines($mcmp.dat) > 1) && ((%wmp.no == $null) || (%wmp.no == 1)) { set %wmp.no 2 }
          .splay stop
          .splay $play.file
          mc.msg
          sc_start $dname 2 100 l 70 $mctitle
          unset %pause.mp3
          mp3.info
        }
      }
      elseif (%a == 4) {
        if (%wmp.no == $null) || ($lines($mcmp.dat) == $calc(%wmp.no -1)) { halt }
        else {
          .splay stop
          set %wmp.no $calc(%wmp.no + 1) 
          .splay $play.file
          mc.msg
          sc_start $dname 2 100 l 70 $mctitle
          unset %pause.mp3
          mp3.info
        }
      }
      elseif (%a == 5) { 
        if ($insong) {
          if (%pause.mp3 != 1) { .splay pause | set %pause.mp3 1 }
          elseif (%pause.mp3 == 1) { .splay resume | unset %pause.mp3 }
        }
      }
      elseif (%a == 6) { mp3stop }
    }
    if ($did == 3) {
      did -i $dname 3 1 tipText Âîñïðîèçâåäåíèå: $time($round($calc($insong.pos / 1000)),nn:ss)
      if ($play.file != $null) { .splay seek $gettok($did(3,1),1,32) }
    } 
    if ($did == 9) { 
      did -i $dname 9 1 tipText Ãðîìêîñòü: $+($round($calc($gettok($did(9,1),1,32) / 655.35),0),%)
      vol -v $gettok($did($dname,9,1),1,32)
    }
  }
  if ($devent == dclick) {
    if ($did($dname,1).sel == 8) {
      dll $dll.path(popup) New mcop 16 16
      dll $dll.path(popup) LoadImg mcop icon small 14, $+ $mcicon
      dll $dll.path(popup) LoadImg mcop icon small 15, $+ $mcicon
      dll $dll.path(popup) LoadImg mcop icon small 16, $+ $mcicon
      dll $dll.path(popup) LoadImg mcop icon small 9, $+ $mcicon
      dll $dll.path(popup) AddItem mcop end 1 &Ïîëíûé âèä $cr fullv
      dll $dll.path(popup) AddItem mcop end
      dll $dll.path(popup) AddItem mcop end 2 Ðàñïîëîæåíèå â &ââåðõó $cr docktop
      dll $dll.path(popup) AddItem mcop end 3 Ðàñïîëîæåíèå &âíèçó $cr dockbot
      dll $dll.path(popup) AddItem mcop end
      dll $dll.path(popup) AddItem mcop end 4 &Ãåíåðèðîâàòü â html $cr generatehtml
      pop mcop $mouse.dx $mouse.dy
    }
  }
  if ($devent == close) {
    dll $dll.path(hOS) Undock $dname
    $+(.timersc_,$dname,*) off
  }
}

on *:mp3end: { soundend }

on *:midiend: { soundend }

on *:waveend: { soundend }

alias -l mw.cls { 
  if ($did(mcmp3,2).lines != 1) {
    write -c $mcmp.dat
    write -c $mcmp3.dat
    did -r mcmp3 2
    unset %wmp.no
    .splay stop
    did -i mcmp3 22 1 params 0 0 1
    sc_start mcmp3 1 100 l 70 $sc.welcome
    unset %pause.mp3
    did -ra mcmp3 15 êá/ñ
    did -ra mcmp3 16 00:00/00:00
    did -ra mcmp3 17 êÃö
    set %files.html 0
  }
}

alias -l del.mwfile {  
  if ($did(mcmp3,2).sel == $null) { halt }
  else {
    var %mfile $did(mcmp3,2).sel
    if (%mfile == %wmp.no) { mp3stop }
    write -dl $+ $calc(%mfile - 1) $mcmp.dat
    write -dl $+ $calc(%mfile - 1) $mcmp3.dat
    loadbuf -ro mcmp3 2 $mcmp3.dat
    set %files.html $lines($mcmp.dat)
    if (%mfile < %wmp.no) {
      set %wmp.no $calc(%wmp.no -1)
      did -c mcmp3 2 %wmp.no
    } 
    else { did -c mcmp3 2 %wmp.no }
  }
}

alias -l add.mwfile {
  if (!$isdir(%mpdir)) { set %mpdir C:\ }
  var %wmp $$sfile( $+ %mpdir $+ ,Âûáåðèòå ìåäèà ôàéë äëÿ èãðû:,Add)
  if (%wmp != $null) {
    set %mpdir $nofile(%wmp)
    write $mcmp.dat %wmp
    write $mcmp3.dat 0 + 0 0 0 $nopath(%wmp)
    loadbuf -ro mcmp3 2 $mcmp3.dat
    set %files.html $lines($mcmp.dat)
    did -c mcmp3 2 %wmp.no
  }
  else { halt }
}

alias -l add.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto adddir }
  else {
    :adddir
    set %mpdir $$sdir( $+ %mpdir $+ ,Âûáåðèòå äèðåêòîðèþ äëÿ äîáàâëåíèÿ)
    if (%mpdir != $null) {
      find.file
      did -c mcmp3 2 %wmp.no
    }
  }
}

alias -l set.mwdir {
  if (%mpdir == $null) { set %mpdir C:\ | goto setdir }
  else {
    :setdir
    set %mpdir $$sdir( $+ %mpdir $+ ,Âûáåðèòå ìåäèà äèðåêòîðèþ)
    if (%mpdir != $null) {
      write -c $mcmp.dat
      write -c $mcmp3.dat
      dll $dll.path(listfiles) setoutput <dir><fname>
      dll $dll.path(listfiles) listfiles f > $mcmp.dat > %mpdir > *.mp3;*.mid;*.wav;*.wma;*.ogg > 0
      dll $dll.path(listfiles) setoutput 0 + 0 0 0 <fname>
      dll $dll.path(listfiles) listfiles f > $mcmp3.dat > %mpdir > *.mp3;*.mid;*.wav;*.wma;*.ogg > 0
      .splay stop
      did -i mcmp3 22 1 params 0 0 1
      sc_start mcmp3 1 100 l 70 $sc.welcome
      did -ra mcmp3 15 êá/ñ
      did -ra mcmp3 16 00:00/00:00
      did -ra mcmp3 17 êÃö
      loadbuf -ro mcmp3 2 $mcmp3.dat
      set %files.html $lines($mcmp.dat)
    }
  }
}

alias -l find.file {
  var %x = $findfile(%mpdir,*.mp3,0,write $mcmp.dat $1-)
  var %x = $findfile(%mpdir,*.mid,0,write $mcmp.dat $1-)
  var %x = $findfile(%mpdir,*.wav,0,write $mcmp.dat $1-)
  var %x = $findfile(%mpdir,*.wma,0,write $mcmp.dat $1-)
  var %x = $findfile(%mpdir,*.ogg,0,write $mcmp.dat $1-)
  var %x = $findfile(%mpdir,*.mp3,0,write $mcmp3.dat 0 + 0 0 0 $nopath($1-))
  var %x = $findfile(%mpdir,*.mid,0,write $mcmp3.dat 0 + 0 0 0 $nopath($1-))
  var %x = $findfile(%mpdir,*.wav,0,write $mcmp3.dat 0 + 0 0 0 $nopath($1-))
  var %x = $findfile(%mpdir,*.wma,0,write $mcmp3.dat 0 + 0 0 0 $nopath($1-))
  var %x = $findfile(%mpdir,*.ogg,0,write $mcmp3.dat 0 + 0 0 0 $nopath($1-))
  loadbuf -ro mcmp3 2 $mcmp3.dat
  set %files.html $lines($mcmp.dat)
}

alias -l loadpl.m3u {
  var %m3ufile $$sfile(*.m3u,Load *.m3u playlist,Load)
  if (!$isfile($shortfn(%m3ufile))) return
  mw.cls
  var %i = 1
  while ($read($shortfn(%m3ufile),n,%i)) {
    var %x $ifmatch
    if ($left(%x,4) != #EXT) && ($right(%x,4) == .mp3) {
      if ($mid(%x,2,1) != $chr(58)) && ($left(%x,1) != $chr(92)) { 
        var %x $nofile($shortfn(%m3ufile)) $+ %x 
      } 
      elseif ($left(%x,1) == $chr(92)) { 
        var %x $left($shortfn(%m3ufile),2) $+ %x
      }
    }
    if ($sound(%x).length) {
      write $mcmp.dat %x 
      write $mcmp3.dat 0 + 0 0 0 $nopath(%x)
    }
    inc %i
  }
  loadbuf -ro mcmp3 2 $mcmp3.dat
  set %files.html $lines($mcmp.dat)
}

alias -l savepl.m3u {
  var %m3ufile $$sfile(*.m3u,Save *.m3u playlist,Save)
  mcProgressbar
  did -a mcProgressbar 1 Ñîõðàíÿþ...
  write -c $shortfn(%m3ufile) #EXTM3U
  var %i = 1
  var %y = $lines($mcmp.dat)
  while (1) {
    var %x = $read($mcmp.dat,n,%i)
    if (!%x) { goto m3ucom | halt }
    write $shortfn(%m3ufile) #EXTINF: $+ $int($calc($sound(%x).length / 1000)) $+ , $+ $file.ext(%x)
    write $shortfn(%m3ufile) %x
    inc %i
    did -ra mcProgressbar 2 $nopath($read($mcmp.dat,%i))
    did -i mcProgressbar 3 1 $calc(%i -1) 0 %y
  }
  :m3ucom
  did -ra mcProgressbar 1 Ñîõðàíÿþ...
  did -ra mcProgressbar 2 Âûïîëíåíî...
  .timerpb -m 1 500 dialog -x mcProgressbar
  did -c mcmp3 2 %wmp.no
}

alias -l file.ext {
  if ($sound($1).artist) && ($sound($1).title) { return $sound($1).artist - $sound($1).title }
  else { return $remove($nopath($1),.mp3,.wav,.mid,.wma,.ogg) }
}

alias -l soundend {
  if ($dialog(mcmp3)) && (!$dialog(mp3dock)) {
    if ($did(mcmp3,2).lines == %wmp.no) {
      did -i mcmp3 22 1 params 0 0 1
      $+(.timersc_,$dname,*) off
      sc_start mcmp3 1 100 l 70 $sc.welcome
      did -ra mcmp3 15 êá/ñ
      did -ra mcmp3 16 00:00/00:00
      did -ra mcmp3 17 êÃö
      halt
    } 
    else {  
      set %wmp.no $calc(%wmp.no +1)
      if ($play.file != $null) { .splay $play.file }
      did -c mcmp3 2 %wmp.no    
      sc_start mcmp3 1 100 l 70 $sc.play
      mc.msg
      mp3.info
    }
  }
  elseif ($dialog(mp3dock)) && (!$dialog(mcmp3)) {
    if ($lines($mcmp.dat) == $calc(%wmp.no -1)) {
      did -i mp3dock 3 1 params 0 0 1      
      $+(.timersc_,$dname,*) off
      sc_start mp3dock 2 100 l 70 $sc.welcome
      did -ra mp3dock 5 êá/ñ
      did -ra mp3dock 4 00:00/00:00
      did -ra mp3dock 6 êÃö
      did -ra mp3dock 7 mode
      halt
    }
    else {  
      set %wmp.no $calc(%wmp.no +1)
      if ($play.file != $null) { .splay $play.file }
      sc_start mp3dock 2 100 l 70 $mctitle
      mc.msg
      mp3.info
    }
  }
}

alias -l play.file return { $shortfn($read($mcmp.dat,$calc(%wmp.no -1))) }

alias -l sc.play return { $remove($nopath($read($mcmp.dat,$calc(%wmp.no -1))),.mp3,.wav,.mid,.wma,.ogg) }

alias -l sc.welcome return { ..... Welcome to Narkoman's Audio Player 1.0 ..... }

alias -l mp3stop {
  .splay stop
  if ($dialog(mcmp3)) { 
    did -i mcmp3 22 1 params 0 0 1
    unset %pause.mp3
    sc_start mcmp3 1 100 l 70 $sc.welcome
    did -ra mcmp3 15 êá/ñ
    did -ra mcmp3 16 00:00/00:00
    did -ra mcmp3 17 êÃö
  }
  elseif ($dialog(mp3dock)) { 
    did -i mp3dock 3 1 params 0 0 1 
    unset %pause.mp3
    sc_start mp3dock 2 100 l 70 $sc.welcome
    did -ra mp3dock 5 êá/ñ
    did -ra mp3dock 4 00:00/00:00 
    did -ra mp3dock 6 khz 
    did -ra mp3dock 7 êÃö
  }
}

alias -l popplay {
  if ($did(mcmp3,2).sel == $null) { halt }
  else {
    if (%pause.mp3 == 1) && (resume != $null) { .splay resume | unset %pause.mp3 }
    else {
      .splay stop
      set %wmp.no $did(mcmp3,2).sel
      if ($play.file != $null) { .splay $play.file }
      unset %pause.mp3
      mc.msg
      sc_start mcmp3 1 100 l 70 $sc.play
      mp3.info
    }
  }
}

alias -l mp3.info {
  if ($insong) {
    if ($dialog(mcmp3)) {
      did -ra mcmp3 15 $sound($play.file).bitrate êá/c
      did -ra mcmp3 17 $round($calc($sound($play.file).sample / 1000),1) êÃö
    }
    elseif ($dialog(mp3dock)) {
      did -ra mp3dock 5 $sound($play.file).bitrate êá/ñ
      did -ra mp3dock 6 $round($calc($sound($play.file).sample / 1000),1) êÃö
      did -ra mp3dock 7 $sound($play.file).mode
    }
  }
  elseif ($inwave) { 
    if ($dialog(mcmp3)) { did -r mcmp3 15 | did -r mcmp3 17 }
    elseif ($dialog(mp3dock)) { did -r mp3dock 5 | did -ra mp3dock 6 .::Wave | did -ra mp3dock 7 playing::. }
  }
  elseif ($inmidi) { 
    if ($dialog(mcmp3)) { did -r mcmp3 15 | did -r mcmp3 17 }
    elseif ($dialog(mp3dock)) { did -r mp3dock 5  | did -ra mp3dock 6 .::Midi  | did -ra mp3dock 7 playing::. }
  }
}

alias -l cnt.length {
  if ($insong) {
    var %t = $time($round($calc($inmp3.pos / 1000),0),nn:ss)
    if ($dialog(mcmp3)) { did -ra mcmp3 16 %t $+ / $+ $time($int($calc($insong($play.file).length / 1000)),nn:ss) }
    elseif ($dialog(mp3dock)) { did -ra mp3dock 4 %t $+ / $+ $time($int($calc($insong($play.file).length / 1000)),nn:ss) }
  }
  elseif ($inmidi) {
    var %t = $time($round($calc($inmidi.pos / 1000),0),nn:ss)
    if ($dialog(mcmp3)) { did -ra mcmp3 16 %t $+ / $+ $time($int($calc($inmidi($play.file).length / 1000)),nn:ss) }
    elseif ($dialog(mp3dock)) { did -ra mp3dock 4 %t $+ / $+ $time($int($calc($inmidi($play.file).length / 1000)),nn:ss) }
  }
  elseif ($inwave) {
    var %t = $time($round($calc($inwave.pos / 1000),0),nn:ss)
    if ($dialog(mcmp3)) { did -ra mcmp3 16 %t $+ / $+ $time($int($calc($inwave($play.file).length / 1000)),nn:ss) }
    elseif ($dialog(mp3dock)) { did -ra mp3dock 4 %t $+ / $+ $time($int($calc($inwave($play.file).length / 1000)),nn:ss) }
  }
}

alias -l pb.length {
  if ($dialog(mp3dock)) && (!$dialog(mcmp3)) { mcttip }
  elseif ($dialog(mcmp3)) && (!$dialog(mp3dock)) { mcttip2 }
  if ($insong) { 
    if ($dialog(mcmp3)) { did -i mcmp3 22 1 params $inmp3.pos 0 $inmp3.length }
    elseif ($dialog(mp3dock)) { did -i mp3dock 3 1 params $inmp3.pos 0 $inmp3.length }
  }
  elseif ($inwave) { 
    if ($dialog(mcmp3)) { did -i mcmp3 22 1 params $inwave.pos 0 $inwave.length }
    elseif ($dialog(mp3dock)) { did -i mp3dock 3 1 params $inwave.pos 0 $inwave.length }
  }
  elseif ($inmidi) { 
    if ($dialog(mcmp3)) { did -i mcmp3 22 1 params $inmidi.pos 0 $inmidi.length }
    elseif ($dialog(mp3dock)) { did -i mp3dock 3 1 params $inmidi.pos 0 $inmidi.length }
  }
}

alias -l writeplhtml return write $shortfn($mircdirsys\mcmp3\mcmp3pl.html)

alias -l generatehtml {
  mcProgressbar
  did -a mcProgressbar 1 Îáðàáàòûâàþ...
  write -c $mircdirsys\mcmp3\mcmp3pl.html
  $writeplhtml $read($shortfn($mircdirsys\mcmp3\config\plhtml.dat), 1)
  $writeplhtml %files.html
  $writeplhtml $read($shortfn($mircdirsys\mcmp3\config\plhtml.dat), 2)
  var %x = 1
  var %y = $calc($lines($mcmp.dat) + 1) 
  while (%x < %y) {
    if ($right($nopath($read($mcmp.dat,%x)),4) == .wav) { var %z = WAVE file }
    elseif ($right($nopath($read($mcmp.dat,%x)),4) == .wma) { var %z = WMA file }
    elseif ($right($nopath($read($mcmp.dat,%x)),4) == .ogg) { var %z = OGG file }
    elseif ($right($nopath($read($mcmp.dat,%x)),4) == .mid) { var %z = MIDI file }
    elseif ($right($nopath($read($mcmp.dat,%x)),4) == .mp3) { var %z = $time($int($calc($sound($read($mcmp.dat,n,%x)).length / 1000)),n:ss) }
    $writeplhtml %x $+ . $nopath($read($mcmp.dat,%x)) ( $+ %z $+ )<br>
    inc %x
    did -ra mcProgressbar 2 $nopath($read($mcmp.dat,%x))
    did -i mcProgressbar 3 1 %x 0 %y
  }
  $writeplhtml $read($shortfn($mircdirsys\mcmp3\config\plhtml.dat), 3)
  did -ra mcProgressbar 1 Îáðàáàòûâàíèå çàêîí÷åíî...
  did -ra mcProgressbar 2 Âûïîëíåíî...
  .timerpb -m 1 500 dialog -x mcProgressbar
  run $mircdirsys\mcmp3\mcmp3pl.html
  if ($dialog(mcmp3)) did -c mcmp3 2 %wmp.no
}

alias -l mctheme { 
  if ($isfile( $+ %thmedir $+ colors.ini) == $false) { halt }
  else {
    $writethme prev $shortfn( $+ %thmedir $+ prev.png)
    $writethme play $shortfn( $+ %thmedir $+ play.png)
    $writethme next $shortfn( $+ %thmedir $+ next.png)
    $writethme pause $shortfn( $+ %thmedir $+ pause.png)   
    $writethme stop $shortfn( $+ %thmedir $+ stop.png)
    $writethme dir $shortfn( $+ %thmedir $+ dir.png)    
    $writethme mute $shortfn( $+ %thmedir $+ mute.png)
    $writethme addir $shortfn( $+ %thmedir $+ addir.png)   
    $writethme addfile $shortfn( $+ %thmedir $+ addfile.png)
    $writethme clear $shortfn( $+ %thmedir $+ clear.png)
    $writethme x $shortfn( $+ %thmedir $+ x.png)
    $writethme help $shortfn( $+ %thmedir $+ help.png)
    $writethme main $shortfn( $+ %thmedir $+ main.bmp)
    $writethme plbg $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, plbg)
    $writethme pltxt $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, pltxt)
    $writethme pltxtbg $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, pltxtbg)
    $writethme plyrbg $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, plyrbg)
    $writethme plyrtxtbg $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, plyrtxtbg)
    $writethme plyrtxt $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, plyrtxt)
    set %mctheme $readini($shortfn( $+ %thmedir $+ colors.ini),n, colors, name)
  }
}

alias -l themez {
  set %prevt $readini($readthme, n, themes, prev)
  set %playt $readini($readthme, n, themes, play)
  set %nextt $readini($readthme, n, themes, next)
  set %pauset $readini($readthme, n, themes, pause)
  set %stopt $readini($readthme, n, themes, stop)
  set %dirt $readini($readthme, n, themes, dir)
  set %mutet $readini($readthme, n, themes, mute)
  set %addirt $readini($readthme, n, themes, addir)
  set %addfilet $readini($readthme, n, themes, addfile)
  set %cleart $readini($readthme, n, themes, clear)
  set %xt $readini($readthme, n, themes, x)
  set %helpt $readini($readthme, n, themes, help)
  set %maint $readini($readthme, n, themes, main)
  set %plbg $readini($readthme, n, themes, plbg)
  set %pltxt $readini($readthme, n, themes, pltxt)
  set %pltxtbg $readini($readthme, n, themes, pltxtbg)
  set %plyrbg $readini($readthme, n, themes, plyrbg)
  set %plyrtxtbg $readini($readthme, n, themes, plyrtxtbg)
  set %plyrtxt $readini($readthme, n, themes, plyrtxt)
}

alias -l fullv { if (%opdesktop == 1) { mcmp3 d } | else { mcmp3 } }

alias -l res.insong {
  if ($dialog(mcmp3)) { dialog -x mcmp3 }
  if (%opdesktop == 1) { mcmp3 d }
  else { mcmp3 }
  if ($insong) || ($inmidi) || ($inwave) { sc_start mcmp3 1 100 l 70 $sc.play | mp3.info }
  else { sc_start mcmp3 1 100 l 70 $sc.welcome }
}

alias -l ID3edit { 
  if ($dialog(mcmp3)) { var %wmp.no $did(mcmp3,2).sel }
  if ($dialog(mp3dock)) && (!$insong) { halt }
  if ($right($nopath($read($mcmp.dat,$calc(%wmp.no -1))),4) == .mp3) {
    mcid3
    id3display1 $read($mcmp.dat,$calc(%wmp.no -1))
  }
}

alias -l id3display1 {
  did -ra mcid3 1 $1-
  did -r mcid3 4,6,8,10,14
  did -u mcid3 12
  if ($sound($1-).title) { did -a mcid3 4 $ifmatch }
  if ($sound($1-).artist) { did -a mcid3 6 $ifmatch }
  if ($sound($1-).album) { did -a mcid3 8 $ifmatch }
  if ($sound($1-).year) { did -a mcid3 10 $ifmatch }
  if ($sound($1-).genre) { did -c mcid3 12 $didwm(mcid3,12,$ifmatch) }
  if ($sound($1-).comment) { did -a mcid3 14 $ifmatch }
  if ($file($1-).size) { did -ra mcid3 17 $ifmatch bytes }
  if ($int($calc($sound($1-).length / 1000))) { did -ra mcid3 19 $ifmatch seconds }
  if ($sound($1-).bitrate) { did -ra mcid3 21 $ifmatch $+ kbit }
  if ($sound($1-).sample) { did -ra mcid3 23 $ifmatch $+ Hz }
  if ($sound($1-).mode) { did -ra mcid3 25 $ifmatch }
  did -ra mcid3 27 $iif($sound($1-).crc,Yes,No)
  did -ra mcid3 29 $iif($sound($1-).copyright,Yes,No)
}

alias -l id3display2 {
  if ($did(mcid3,4) == $null) { dll $dll.path(id3) ID3v1Title $1- $+ $chr(124) $+ N/A }
  else { dll $dll.path(id3) ID3v1Title $1- $+ $chr(124) $+ $did(mcid3,4) }
  if ($did(mcid3,6) == $null) { dll $dll.path(id3) ID3v1Artist $1- $+ $chr(124) $+ N/A }
  else { dll $dll.path(id3) ID3v1Artist $1- $+ $chr(124) $+ $did(mcid3,6) }
  if ($did(mcid3,8) == $null) { dll $dll.path(id3) ID3v1Album $1- $+ $chr(124) $+ N/A }
  else { dll $dll.path(id3) ID3v1Album $1- $+ $chr(124) $+ $did(mcid3,8) }
  if ($did(mcid3,10) == $null) { dll $dll.path(id3) ID3v1Year $1- $+ $chr(124) $+ N/A }
  else { dll $dll.path(id3) ID3v1Year $1- $+ $chr(124) $+ $did(mcid3,10) }
  if ($did(mcid3,12).sel) { dll $dll.path(id3) ID3v1GenreID $1- $+ $chr(124) $+ $calc($did(mcid3,12).sel -1) }
  if ($did(mcid3,14) == $null) { dll $dll.path(id3) ID3v1Comment $1- $+ $chr(124) $+ N/A }
  else { dll $dll.path(id3) ID3v1Comment $1- $+ $chr(124) $+ $did(mcid3,14) }
  id3display1 $1-
}

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 mc.msg {
  if ($status == connected) {
    if ($insong) { var %x $time($int($calc($insong($play.file).length / 1000)),nn:ss) }
    elseif ($inmidi) { var %x $time($int($calc($inmidi($play.file).length / 1000)),nn:ss) }
    elseif ($inwave) { var %x $time($int($calc($inwave($play.file).length / 1000)),nn:ss) }
    if (%bmethod == active) && ($active ischan) {
      msg $active 3,0.4:5:14Narkoman's Audio Player 1.05:4:3.3,6 .4:5:14 $+ $remove($nopath($read($mcmp.dat,$calc(%wmp.no -1))),.mp3,.wav,.mid,.wma,.ogg) ( $+ %x $+ ) $+ 5:4:3.
    }
    elseif (%bmethod == amsg) {
      amsg 3,0.4:5:14Narkoman's Audio Player 1.05:4:3.3,6 .4:5:14 $+ $remove($nopath($read($mcmp.dat,$calc(%wmp.no -1))),.mp3,.wav,.mid,.wma,.ogg) ( $+ %x $+ ) $+ 5:4:3.
    }
  }
}

alias -l docktop {
  if ($dialog(mp3dock)) && (%dock.pos == top) { halt }
  elseif ($dialog(mp3dock)) && (%dock.pos != top) { dialog -c mp3dock | set %dock.pos top | mp3dock }
  elseif (!$dialog(mp3dock)) { set %dock.pos top | mp3dock }
}

alias -l dockbot {
  if ($dialog(mp3dock)) && (%dock.pos == bottom) { halt }
  elseif ($dialog(mp3dock)) && (%dock.pos != bottom) { dialog -c mp3dock | set %dock.pos bottom | mp3dock }
  elseif (!$dialog(mp3dock)) { set %dock.pos bottom  | mp3dock }
}

alias -l mcttip {
  if ($insong) || ($inwave) || ($inmidi) { set %mc.info Ïåñíÿ: $sound($play.file).title $crlf $+ Èñïîëíèòåëü: $sound($play.file).artist $crlf $+ Àëüáîì: $sound($play.file).album $crlf $+ Ñòèëü: $sound($play.file).genre $crlf $+ Ïàïêà: $nofile($read($mcmp.dat,$calc(%wmp.no -1))) } 
  else { set %mc.info none }
  dll $dll.path(tooltip) Mark $dialog(mp3dock).hwnd
  dll $dll.path(tooltip) ToolTip $dialog(mp3dock).hwnd > 2 balloon
  dll $dll.path(tooltip) SetText $dialog(mp3dock).hwnd > 2 %mc.info
  dll $dll.path(tooltip) SetTitle $dialog(mp3dock).hwnd > 2 1 Òåêóùåå âîñïðîèçâåäåíèå:
}

alias -l mcttip2 {
  if ($insong) || ($inwave) || ($inmidi) { set %mc.info Ïåñíÿ: $sound($play.file).title $crlf $+ Èñïîëíèòåëü: $sound($play.file).artist $crlf $+ Àëüáîì: $sound($play.file).album $crlf $+ Ñòèëü: $sound($play.file).genre $crlf $+ Ïàïêà: $nofile($read($mcmp.dat,$calc(%wmp.no -1))) } 
  else { set %mc.info none }
  dll $dll.path(tooltip) Mark $dialog(mcmp3).hwnd
  dll $dll.path(tooltip) ToolTip $dialog(mcmp3).hwnd > 1 balloon
  dll $dll.path(tooltip) SetText $dialog(mcmp3).hwnd > 1 %mc.info
  dll $dll.path(tooltip) SetTitle $dialog(mcmp3).hwnd > 1 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 mcmp5.dat return $shortfn($scriptdirconfig\mcMP5.dat)

alias -l mcmp4.dat return $shortfn($scriptdirconfig\mcMP4.dat)

alias -l mcmp3.dat return $shortfn($scriptdirconfig\mcMP3.dat)

alias -l mcmp2.dat return $shortfn($scriptdirconfig\mcMP2.dat)

alias -l mcmp1.dat return $shortfn($scriptdirconfig\mcMP1.dat)

alias -l mcmp.dat return $shortfn($scriptdirconfig\mcMP.dat)

alias -l mctitle return .:: Narkoman's Audio Player 1.0 ::. .:: $sc.play ::.

alias -l writethme return writeini -n $shortfn($scriptdirconfig\themes.ini) themes

alias -l readthme return $shortfn($scriptdirconfig\themes.ini)

alias -l mcicon return $shortfn($scriptdirimages\mcmp3.icl)

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

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

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

alias -l dll.path {
  if ($1 == mdx) return $shortfn($scriptdirdlls\mdx\mdx.dll)
  elseif ($1 == imgdlg) return $shortfn($scriptdirdlls\ImgDlg\imgdlg.dll)
  elseif ($1 == popup) return $shortfn($scriptdirdlls\popups\popups.dll)
  elseif ($1 == id3) return $shortfn($scriptdirdlls\ID3Changer\ID3Changer.dll)
  elseif ($1 == tdialog) return $shortfn($scriptdirdlls\tdialog\tdialog.dll)
  elseif ($1 == hOS) return $shortfn($scriptdirdlls\hOS\hOS.dll)
  elseif ($1 == tooltip) return $shortfn($scriptdirdlls\tooltip\tooltip.dll)
  elseif ($1 == listfiles) return $shortfn($scriptdirdlls\listfiles\listfiles.dll)
}

menu menubar {
  -
  Narkoman's Audio Player 
  .Îòêðûòü íà ðàáî÷åì ñòîëå:mcmp3 d | set %opdesktop 1
  .Îòêðûòü â Narkoman's Script:mcmp3 | unset %opdesktop
  .Ïîçèöèÿ ïëååðà 
  ..Ââåðõó:docktop
  ..Âíèçó:dockbot
  .-
  .Ïðîçðà÷íîñòü
  ..0:set %mctrans -1 | set %mctrans2 none | res.insong
  ..10:set %mctrans 10 | set %mctrans2 10 | res.insong
  ..20:set %mctrans 20 | set %mctrans2 20 | res.insong
  ..30:set %mctrans 30 | set %mctrans2 30 | res.insong
  ..40:set %mctrans 40 | set %mctrans2 40 | res.insong
  ..50:set %mctrans 50 | set %mctrans2 50 | res.insong
  ..60:set %mctrans 60 | set %mctrans2 60 | res.insong
  ..70:set %mctrans 70 | set %mctrans2 70 | res.insong
  ..80:set %mctrans 80 | set %mctrans2 80 | res.insong
  ..90:set %mctrans 90 | set %mctrans2 90 | res.insong
  ..100:set %mctrans 100 | set %mctrans2 100 | res.insong
  .-
  .Ïîèñê ôàéëà:mcsearch
  .-  
  .Ïîêàç òðåêà íà êàíàë(û)
  ..&active:set %bmethod active
  ..a&msg:set %bmethod amsg
  ..&íåíàäî:set %bmethod none
  .-
  .Ïîìîùü:run $shortfn($scriptdirhelp.htm)
  .-
}

alias saychanfx {
  if ($insong) { var %x $time($int($calc($insong($play.file).length / 1000)),nn:ss) }
  if ($active ischan) {
    /me 3,0.4:5:14Narkoman's Audio Player 3By 8[Stin4geR] 1.05:4:3. 7,2... :::|Òðåê|::: ... --> 3,6 .4:5:14 $+ $remove($nopath($read($mcmp.dat,$calc(%wmp.no -1))),.mp3,.wav,.mid,.wma,.ogg) ( $+ %x $+ ) $+ 5:4:3.
  }
}

alias saychanfx2 {
  if ($insong) { var %x $time($int($calc($insong($play.file).length / 1000)),nn:ss) }
  /me 3,0.4:5:14Narkoman's Audio Player 1.05:4:3. 7,2... :::|Òðåê|::: ... --> 3,6 .4:5:14 $+ $remove($nopath($read($mcmp.dat,$calc(%wmp.no -1))),.mp3,.wav,.mid,.wma,.ogg) ( $+ %x $+ ) $+ 5:4:3.
}
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
;;;;;;;;;;;;;;; >>>>>>>> Narkoman's Script ver: 3.5   All Rights Reserved. Copyright Narkoman's™ 2006 - 2007 <<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>> ñîçäàòåëü - _TRANE_ <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;; >>>>>>>>>>>>> Îá îøèáêàõ ïèøèòå íà: narkoo-master@mail.ru èëè narkoo-master@maxalina.net <<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 
;;;;;;;;;;;;;;; >>>>>>>>>>>>>>>>>>>>> Îôèöèàëüíûé ñàéò ñêðèïòà: http://www.narkomans.ucoz.ru <<<<<<<<<<<<<<<<<<<<<<<<<<<< ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
