dna: mp3 player addon — File Browser

dnamp3playeraddonv1.2 / dnamp3playeraddonv1.2 / dna_mp3addon.mrc

dna_mp3addon.mrc — 21.36 KB — Download this file

;« dna: mp3 addon version 1.2 ».........................
;« made by rÿche ».........................
;=========================================
; Author Notes: I know this code may look very "unprofessional", hell I don't care.  
; ---------------------  As long as no one can easily rip this off, I'm happy.  I know what
; ---------------------  this stuff does, and it does work.  And please don't rip this off and
;----------------------  call it your own, too many wasted hours went into this.  -rÿche
;=========================================
;« Load/Installation ».........................
;=========================================
on 1:load:{
  if ($version >= 5.8) {
    if ($$?!="Do you wish to set a F-key for the dialog?") { 
      set %dna.mp3.fkey $$?="Enter an F-key (F1-12) for the mp3 player dialog"
      var %x = 1
      :loop
      if ((%dna.mp3.fkey != F $+ %x) && (%x != 13)) { inc %x 1 | goto loop }
      if (%dna.mp3.fkey == F $+ %x) { goto outloop }
      else { set %dna.mp3.fkey $$?="Your F-key was invalid, please enter in a new one" | var %x = 1 | goto loop }
    }
    else { set %dna.mp3.fkey None }
    :outloop
    if (%dna.mp3.broadcast.type == $null) { set %dna.mp3.broadcast.type describe }
    if (%dna.mp3.message == $null) { set %dna.mp3.message is currently listening to « [mp3] » }
    dna.fkey.assignment
    halt
  }
  else { .echo -a Your version ( $+ $version $+ ) of mIRC is not compatible with this addon. | .echo -a This addon requires mIRC 5.8 or above to work. | .echo -a This addon will now uninstall itself | /unload -rs dna_mp3addon.mrc }
}
;=========================================
;« mp3 Dialog ».........................
;=========================================
dialog dna_mp3 {
  title "dna: mp3 player - by: rÿche (ryche@edgenetwk.com)"
  size -1 -1 240 163
  option dbu
  menu "&Add" , 60
  item "&File", 70, ok
  item "&Dir", 80
  menu "&Del" , 61
  item "&File", 71
  item "&All", 81
  menu "&List" , 62
  menu "&Load", 7, 62
  item ".m3u Playlist", 74
  item ".pls Playlist", 75 
  item "&New",8, 62
  menu "Sort", 64,
  item "by Title", 651
  item "by Path && Filename", 671

  box "playlist", 1, 1 1 143 156
  list 2, 2 8 140 148, vsbar
  list 19, 149 3 86 11, autohs

  box "", 116, 145 10 95 18
  box "", 114, 145 11 95 18
  button "&play", 10, 146 15 16 11, default
  button "p&rev", 17, 204 15 16 11, default
  button "ne&xt", 18, 222 15 16 11, default
  button "&pause", 33, 164 15 20 11, default
  button "&stop", 34, 186 15 16 11, default
  text "current song", 15, 146 38 40 11
  list 16, 144 46 96 11, autohs
  box "", 115, 146 31 93 1
  box "", 104, 146 32 93 1
  box "", 105, 146 33 93 1
  box "", 118, 146 57 93 1
  box "", 109, 146 58 93 1
  box "", 110, 146 59 93 1
  check "random", 14, 146 64 30 11, left
  text "assigned f-key", 66, 147 75 39 7
  combo 67, 184 73 26 66, drop
  box "", 117, 146 31 93 1
  box "", 107, 146 32 93 1
  box "", 108, 146 33 93 1
  box "", 119, 146 60 93 50
  radio "Local Broadcast", 77, 147 87 49 7
  radio "Global Broadcast", 78, 147 94 50 7
  radio "No Broadcast", 79, 147 101 47 7

  box "", 120, 146 113 93 1
  box "", 121, 146 114 93 1
  box "", 122, 146 115 93 1

  text "message text (see readme for format)", 90, 146 119 90 7
  edit "", 91, 144 126 96 11, autohs

  box "", 123, 145 134 49 18
  box "", 124, 145 135 49 18
  button "retrieve", 92, 146 139 25 11, default
  button "save", 93, 172 139 20 11, default


  button "close",99 , 221 142 18 11, ok
  text "dna mp3 addon by: rÿche (ryche@edgenetwk.com)", 38, 135 157 200 13, left
} 
;=========================================
;« mp3 On Dialogs ».........................
;=========================================
on *:dialog:dna_mp3:init:0:{ 
  .remove dna_tempmp3list.ini 
  did -a dna_mp3 67 F1
  did -a dna_mp3 67 F2
  did -a dna_mp3 67 F3
  did -a dna_mp3 67 F4
  did -a dna_mp3 67 F5
  did -a dna_mp3 67 F6
  did -a dna_mp3 67 F7
  did -a dna_mp3 67 F8
  did -a dna_mp3 67 F9
  did -a dna_mp3 67 F10
  did -a dna_mp3 67 F11
  did -a dna_mp3 67 F12
  did -a dna_mp3 67 None
  if (%dna.mp3.fkey != $null) { 
    if (%dna.mp3.fkey == F1) { did -c dna_mp3 67 1 }
    if (%dna.mp3.fkey == F2) { did -c dna_mp3 67 2 }
    if (%dna.mp3.fkey == F3) { did -c dna_mp3 67 3 }
    if (%dna.mp3.fkey == F4) { did -c dna_mp3 67 4 }
    if (%dna.mp3.fkey == F5) { did -c dna_mp3 67 5 }
    if (%dna.mp3.fkey == F6) { did -c dna_mp3 67 6 }
    if (%dna.mp3.fkey == F7) { did -c dna_mp3 67 7 }
    if (%dna.mp3.fkey == F8) { did -c dna_mp3 67 8 }
    if (%dna.mp3.fkey == F9) { did -c dna_mp3 67 9 }
    if (%dna.mp3.fkey == F10) { did -c dna_mp3 67 10 }
    if (%dna.mp3.fkey == F11) { did -c dna_mp3 67 11 }
    if (%dna.mp3.fkey == F12) { did -c dna_mp3 67 12 }
    if (%dna.mp3.fkey == None) { did -c dna_mp3 67 13 }
  }
  if (%dna.mp3.broadcast.type == describe) { did -c dna_mp3 77 }
  if (%dna.mp3.broadcast.type == ame) { did -c dna_mp3 78 }
  if (%dna.mp3.broadcast.type == none) { did -c dna_mp3 79 }
  if ($inmp3 == $true) { did -a dna_mp3 16 %dna.mp3.current }
  if (%dna.mp3.repeat1 == Yes) { did -c dna_mp3 12 }
  if (%dna.mp3.loop == Yes) { did -c dna_mp3 13 }
  if (%dna.mp3.random == Yes) { did -c dna_mp3 14 }
  if (%dna.mp3.message != $null) { did -r dna_mp3 91 | did -a dna_mp3 91 %dna.mp3.message }
  if (%dna.mp3.list != $null) { did -r dna_mp3 19 | did -a dna_mp3 19 %dna.mp3.list
    var %x = 1
    did -r dna_mp3 2 
    :loop
    if ($exists(%dna.mp3.list)) { 
      var %temp = $read -l $+ %x %dna.mp3.list 
      if ($left(%temp,4) == #EXT) { inc %x 1 | goto loop }
      else { 
        if (%temp == $null) { goto outloop }
        else {
          var %temp3 = $mid(%temp,$pos(%temp,\,$pos(%temp,\,0)),0) - 1
          var %temp2 = $right(%temp,%temp3)
          %temp2 = $left(%temp2,-4)
          did -a dna_mp3 2 %temp2
          write dna_tempmp3list.ini %temp
          inc %x 1
          goto loop
        }
      }
    }
  }
  :outloop
  if ($inmp3 == $true) { 
    did -r dna_mp3 16
    did -a dna_mp3 16 %dna.mp3.current 
    var %temp1 = $read -w* $+ %dna.mp3.current $+ * dna_tempmp3list.ini 
    var %temp1 = $readn
    did -c dna_mp3 2 %temp1
  }
}
on *:dialog:dna_mp3:dclick:2:{   
  var %temp = $did(dna_mp3,2).sel
  set %dna.mp3.current $did(dna_mp3,2,%temp).text
  var %temp2 = $read -l $+ %temp dna_tempmp3list.ini

  if ($mid(%temp2,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp2 }
  if (%mp3temp == $null) { splay -p $shortfn(%temp2) } 
  else { splay -p $shortfn(%mp3temp) }
  did -r dna_mp3 16
  did -a dna_mp3 16 %dna.mp3.current
  var %temp.message = $replace(%dna.mp3.message, [mp3], $did(dna_mp3,2,%temp) )

  if (%dna.mp3.broadcast.type == describe) { var %dna.mp3.broadcast.type = %dna.mp3.broadcast.type $active }
  if (%dna.mp3.broadcast.type != none) { if ($active != Status Window) { %dna.mp3.broadcast.type %temp.message } }
  if (%dna.mp3.usedmp3end == 1) { set %dna.mp3.usedmp3end 0 }
}
on *:dialog:dna_mp3:menu:8:{ .timer -m 1 1 dna.new.list }
on *:dialog:dna_mp3:sclick:10:{ dna.play.mp3 }
on *:dialog:dna_mp3:sclick:14:{ if (%dna.mp3.random == Yes) { set %dna.mp3.random No } | else { set %dna.mp3.random Yes } }
on *:dialog:dna_mp3:sclick:17:{  
  if (%dna.mp3.random == Yes) {
    var %temp.max = $did(dna_mp3,2).lines
    var %temp = $rand(1,%temp.max) 
    :loop
    if ($did(dna_mp3,2,%temp).text == %dna.mp3.current) { 
      var %temp = $rand(1,%temp.max) | goto loop
    }
    set %dna.mp3.current $did(dna_mp3,2,%temp).text
  }
  else { 
    var %temp = $read -w* $+ %dna.mp3.current $+ * dna_tempmp3list.ini
    var %temp = $readn
  }
  if (%temp != 1) { dec %temp 1 }
  else { %temp = $lines(dna_tempmp3list.ini) } 
  var %temp2 = $read -l $+ %temp dna_tempmp3list.ini

  if ($mid(%temp2,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp2 }
  if (%mp3temp == $null) { splay -p $shortfn(%temp2) } 
  else { splay -p $shortfn(%mp3temp) } 
  did -c dna_mp3 2 %temp
  did -r dna_mp3 16
  set %dna.mp3.current $did(dna_mp3,2,%temp).text
  did -a dna_mp3 16 %dna.mp3.current

  var %temp.message = $replace(%dna.mp3.message, [mp3], $did(dna_mp3,2,%temp) )

  if (%dna.mp3.broadcast.type == describe) { var %dna.mp3.broadcast.type = %dna.mp3.broadcast.type $active }
  if (%dna.mp3.broadcast.type != none) { if ($active != Status Window) { %dna.mp3.broadcast.type %temp.message } }
  if (%dna.mp3.usedmp3end == 1) { set %dna.mp3.usedmp3end 0 }
}
on *:dialog:dna_mp3:sclick:18:{
  if (%dna.mp3.random == Yes) {
    var %temp.max = $did(dna_mp3,2).lines
    var %temp = $rand(1,%temp.max) 
    :loop
    if ($did(dna_mp3,2,%temp).text == %dna.mp3.current) { 
      var %temp = $rand(1,%temp.max) | goto loop
    }
    set %dna.mp3.current $did(dna_mp3,2,%temp).text
  }
  else {
    var %temp = $read -w* $+ %dna.mp3.current $+ * dna_tempmp3list.ini
    var %temp = $readn
    inc %temp 1
  }
  var %temp2 = $read -l $+ %temp dna_tempmp3list.ini

  if ($mid(%temp2,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp2 }
  if (%mp3temp == $null) { splay -p $shortfn(%temp2) } 
  else { splay -p $shortfn(%mp3temp) } 
  did -c dna_mp3 2 %temp
  did -r dna_mp3 16
  set %dna.mp3.current $did(dna_mp3,2,%temp).text
  did -a dna_mp3 16 %dna.mp3.current

  var %temp.message = $replace(%dna.mp3.message, [mp3], $did(dna_mp3,2,%temp) )

  if (%dna.mp3.broadcast.type == describe) { var %dna.mp3.broadcast.type = %dna.mp3.broadcast.type $active }
  if (%dna.mp3.broadcast.type != none) { if ($active != Status Window) { %dna.mp3.broadcast.type %temp.message } }
  if (%dna.mp3.usedmp3end == 1) { set %dna.mp3.usedmp3end 0 }
}
on *:dialog:dna_mp3:sclick:33:{ 
  if ($did(dna_mp3,33).text == &pause) { splay -p pause | did -r dna_mp3 33 | did -a dna_mp3 33 &resume }
  else { splay -p resume | did -r dna_mp3 33 | did -a dna_mp3 33 &pause }
}
on *:dialog:dna_mp3:sclick:34:{ 
  if (%dna.mp3.usedmp3end == 1) { 
    var %temp = $read -w* $+ %dna.mp3.current $+ * dna_tempmp3list.ini
    if ($mid(%temp,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp }
    if (%mp3temp == $null) { splay -p $shortfn(%temp) } 
    else { splay -p $shortfn(%mp3temp) } 
  }
  splay -p stop
  set %dna.mp3.usedmp3end 0
}
on *:dialog:dna_mp3:sclick:67:{ 
  set %dna.mp3.fkey $did(dna_mp3,67,$did(67).sel)
  if ($did(dna_mp3,67,$did(67).sel) != None) { dna.fkey.assignment }
  else { .disable #DNAMP3FKEY }
}
on *:dialog:dna_mp3:menu:70:{ .timer -m 1 1 dna.add.mp3 }
on *:dialog:dna_mp3:menu:71:{ 
  var %temp = $read -w* $+ $did(2,$did(2).sel) $+ * %dna.mp3.list
  var %mp3.num $readn
  if ($left(%temp,4) == #EXT) { inc %mp3.num 1 | write -dl $+ %mp3.num %dna.mp3.list | dec %mp3.num 1 }
  write -dl $+ %mp3.num %dna.mp3.list
  write -dl $+ %mp3.num dna_tempmp3list.ini 
  did -d dna_mp3 2 $did(2).sel 
}
;; the extra alias here in 74 and 75 is because mIRC wouldn't do: .timer -m 1 1 dna.load.list(somethinghere) in the on dialog.
on *:dialog:dna_mp3:menu:74:{ .timer -m 1 1 dna.playlist.m3u }
on *:dialog:dna_mp3:menu:75:{ .timer -m 1 1 dna.playlist.pls }
on *:dialog:dna_mp3:sclick:77:{ set %dna.mp3.broadcast.type describe }
on *:dialog:dna_mp3:sclick:78:{ set %dna.mp3.broadcast.type ame }
on *:dialog:dna_mp3:sclick:79:{ set %dna.mp3.broadcast.type none }
on *:dialog:dna_mp3:menu:80:{ .timer -m 1 1 dna.add.dir }
on *:dialog:dna_mp3:menu:81:{ write -c %dna.mp3.list | did -r dna_mp3 2 | .remove dna_tempmp3list.ini }
on *:dialog:dna_mp3:edit:91:{ set %dna.mp3.message $did(91) }
on *:dialog:dna_mp3:sclick:92:{ .timer -m 1 1 dialog -mv dna_mp3_2 dna_mp3_2 }
on *:dialog:dna_mp3:sclick:93:{ write dna_mp3message.ini $did(91) }
on *:dialog:dna_mp3:menu:651:{ $dna.mp3.list.sort(title) }
on *:dialog:dna_mp3:menu:671:{ $dna.mp3.list.sort(tf) }
;=========================================
;« mp3 Aliases ».........................
;=========================================
alias dna.add.mp3 { 
  var %temp = $$file="Choose a song" c:\*.mp3 
  var %temp3 = $mid(%temp,$pos(%temp,\,$pos(%temp,\,0)),0) - 1 
  var %temp2 = $right(%temp,%temp3) 
  %temp2 = $left(%temp2,-4) 
  did -a dna_mp3 2 %temp2 
  write %dna.mp3.list %temp 
  write dna_tempmp3list.ini %temp 
  dialog -v dna_mp3 dna_mp3 
}
alias dna.add.dir { 
  var %temp = $$sdir="Choose a dir" 
  var %x = 1
  :loop
  var %temp4 = $findfile(%temp,*.mp3,%x)
  if (%temp4 != $null) { 
    var %temp3 = $mid(%temp4,$pos(%temp4,\,$pos(%temp4,\,0)),0) - 1 
    var %temp2 = $right(%temp4,%temp3) 
    var %temp2 = $left(%temp2,-4)
    did -a dna_mp3 2 %temp2 
    write %dna.mp3.list %temp4
    write dna_tempmp3list.ini %temp4
    inc %x 1 
    goto loop
  }
  dialog -v dna_mp3 dna_mp3
}
alias dna.playlist.m3u { $dna.load.list(c:\*.m3u) }
alias dna.playlist.pls { $dna.load.list(c:\*.pls) }
alias dna.load.list { 
  set %dna.mp3.list $$file="Choose a list" $1
  did -r dna_mp3 2 
  var %x = 1 
  did -r dna_mp3 19
  did -a dna_mp3 19 %dna.mp3.list
  dialog -v dna_mp3 dna_mp3
  .remove dna_tempmp3list.ini 
  :loop
  var %temp = $read -l $+ %x %dna.mp3.list
  if ($left(%temp,4) == #EXT) { inc %x 1 | goto loop }
  else { 
    if (%temp == $null) { halt }
    else {
      var %temp3 = $mid(%temp,$pos(%temp,\,$pos(%temp,\,0)),0) - 1
      var %temp2 = $right(%temp,%temp3)
      %temp2 = $left(%temp2,-4)
      did -a dna_mp3 2 %temp2
      write dna_tempmp3list.ini %temp
      inc %x 1
      goto loop
    }
  }
}

alias dna.new.list { 
  did -r dna_mp3 2 
  var %mp3.dir $$sdir="Select a directory to save the playlist to" c:\
  set %dna.mp3.list %mp3.dir $+ $$?="Enter a name for the playlist (.m3u or .pls)"
  write -c %dna.mp3.list
  .remove dna_tempmp3list.ini
  did -r dna_mp3 19 
  did -a dna_mp3 19 %dna.mp3.list
  dialog -v dna_mp3 dna_mp3
}
alias dna.fkey.assignment { 
  var %x = 1
  while (%x != 13) {
    if (%dna.mp3.fkey == F $+ %x) { .enable #DNAMP3FKEY | halt }
    else { inc %x 1 }
  }
}
alias dna.play.mp3 {
  if (%dna.mp3.random == Yes) {
    var %temp.max = $did(dna_mp3,2).lines
    var %temp = $rand(1,%temp.max) 
    :loop
    if ($did(dna_mp3,2,%temp).text == %dna.mp3.current) { 
      var %temp = $rand(1,%temp.max) | goto loop
    }
    set %dna.mp3.current $did(dna_mp3,2,%temp).text
  }
  else {
    if ($did(dna_mp3,2).sel == $null) { halt }
    var %temp = $did(dna_mp3,2).sel
    set %dna.mp3.current $did(dna_mp3,2,%temp).text
  }
  var %temp2 = $read -l $+ %temp dna_tempmp3list.ini
  if ($mid(%temp2,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp2 }
  if (%mp3temp == $null) { splay -p $shortfn(%temp2) } 
  else { splay -p $shortfn(%mp3temp) } 
  did -c dna_mp3 2 %temp
  did -r dna_mp3 16
  did -a dna_mp3 16 %dna.mp3.current
  var %temp.message = $replace(%dna.mp3.message, [mp3], $did(dna_mp3,2,%temp) )
  if (%dna.mp3.broadcast.type == describe) { var %dna.mp3.broadcast.type = %dna.mp3.broadcast.type $active }
  if (%dna.mp3.broadcast.type != none) { if ($active != Status Window) { %dna.mp3.broadcast.type %temp.message } }
  if (%dna.mp3.usedmp3end == 1) { set %dna.mp3.usedmp3end 0 }
}
alias uninstalldnamp3 { if ($$?!="Are you sure you want to uninstall this addon?") { unset %dna.mp3.* | .remove dna_tempmp3list.ini | .remove dna_mp3message.ini | unload -rs dna_mp3addon.mrc } } 
alias dna.del.message { if ($$?!="Are you sure you want to delete this?") { write -dl $+ did(dna_mp3_2,3).sel dna_mp3message.ini | did -d dna_mp3_2 3 $did(dna_mp3_2,3).sel } }
alias dna.mp3.list.sort { 
  var %max.lines = $did(dna_mp3,2).lines
  inc %max.lines 1
  var %x = 1
  if ($1 == title) {
    while (%x != %max.lines) {
      write -l $+ %x dna_temp.ini $did(dna_mp3,2, %x)
      inc %x 1
    }
  }
  if ($1 == tf) { 
    while (%x != %max.lines) {
      var %temp = $read -l $+ %x dna_tempmp3list.ini
      write -l $+ %x dna_temp.ini %temp
      inc %x 1
    }
  }
  var %x = 1
  while (%x != %max.lines) {
    var %y = 1
    var %temp = $read -l %x dna_temp.ini
    while (%y != %max.lines) {
      var %temp2 = $read -l %y dna_temp.ini
      var %temp3 = %temp $+ . $+ %temp2
      if ($dna.match(%temp3)) { var %fnord = 0 | inc %y 1 }
      else { 
        write -l $+ %x dna_temp.ini %temp2
        write -l $+ %y dna_temp.ini %temp
        var %y = %max.lines
        var %fnord = 1
      }
    }
    if (%fnord != 1) { inc %x 1 }
  }
  did -r dna_mp3 2
  ;« this needs to be backwards because the sorting flip flops. above, so I need to flip flop it back. »......................... 
  var %y = 1
  while (%x != 1) { 
    dec %x 1
    var %z = 1
    var %temp = $read -l $+ %x dna_temp.ini
    if ($1 == tf) { 
      write -l $+ %y %dna.mp3.list %temp 
    }
    else { 
      while (%z != %max.lines) {
        var %temp.mp3 = $read -l $+ %z dna_tempmp3list.ini
        if (%temp isin %temp.mp3) { write -l $+ %y %dna.mp3.list %temp.mp3 | break }
        else { inc %z 1 }
      }
    }
    if ($1 == tf) {  
      var %temp3 = $mid(%temp,$pos(%temp,\,$pos(%temp,\,0)),0) - 1
      var %temp2 = $right(%temp,%temp3)
      %temp = $left(%temp2,-4) 
    }
    did -a dna_mp3 2  %temp
    inc %y 1
  }
  .remove dna_temp.ini
}
;« this is its own alias to make the alias above look a bit cleaner. »......................... 
alias dna.match {
  if ($gettok($sorttok($1,46),1,46) == $gettok($1,1,46)) { return $true }
  else { return $false }
}
;=========================================
;« mp3end ».........................
;=========================================
on *:mp3end:{
  if ($dialog(dna_mp3) != $null) { 
    if (%dna.mp3.random == Yes) {
      var %temp.max = $did(dna_mp3,2).lines
      var %temp = $rand(1,%temp.max) 
      :loop
      if ($did(dna_mp3,2,%temp).text == %dna.mp3.current) { 
        var %temp = $rand(1,%temp.max) | goto loop
      }
      set %dna.mp3.current $did(dna_mp3,2,%temp).text
    }
    else {
      var %temp = $read -w* $+ %dna.mp3.current $+ * dna_tempmp3list.ini
      var %temp = $readn
      inc %temp 1
    }
    var %temp2 = $read -l $+ %temp dna_tempmp3list.ini
    if ($mid(%temp2,2,1) != :) { var %mp3temp = $nofile(%dna.mp3.list) $+ %temp2 }
    if (%mp3temp == $null) { splay -p $shortfn(%temp2) } 
    else { splay -p $shortfn(%mp3temp) } 
    set %dna.mp3.current $did(dna_mp3,2,%temp).text
    did -c dna_mp3 2 %temp | did -r dna_mp3 16 | did -a dna_mp3 16 %dna.mp3.current
    var %temp.message = $replace(%dna.mp3.message, [mp3], $did(dna_mp3,2,%temp) )

    if (%dna.mp3.broadcast.type == describe) { var %dna.mp3.broadcast.type = %dna.mp3.broadcast.type $active }
    if (%dna.mp3.broadcast.type != none) { if ($active != Status Window) { %dna.mp3.broadcast.type %temp.message } }
    set %dna.mp3.usedmp3end 1
  }
}
;=========================================
;« mp3 message dialog ».........................
;=========================================
dialog dna_mp3_2 {
  title "dna: mp3 message retriever"
  size -1 -1 141 67
  option dbu

  box "Messge", 1, 0 1 141 50
  button "&Close", 8, 1 54 19 12, ok
  button "Set Message", 9, 24 54 40 12, default
  button "Del Message", 10, 68 54 40 12, default
  combo 3, 1 10 139 46, autohs
}
on *:dialog:dna_mp3_2:init:0:{ 
  var %x = 1 
  :loop
  var %temp = $read -l $+ %x dna_mp3message.ini
  if (%temp == $null) { goto outloop }
  else { did -a dna_mp3_2 3 %temp | inc %x 1 | goto loop }
  :outloop
}
on *:dialog:dna_mp3_2:sclick:9:{ set %dna.mp3.message $did(3,$did(3).sel).text | if ($dialog(dna_mp3) != $null) { did -r dna_mp3 91 | did -a dna_mp3 91 %dna.mp3.message } }
on *:dialog:dna_mp3_2:sclick:8:{ if ($dialog(dna_mp3) != $null)  { dialog -v dna_mp3 } }
on *:dialog:dna_mp3_2:sclick:10:{ .timer -m 1 1 dna.del.message }
;=========================================
;« F-Keys ».........................
; Author Notes: Now this took me a day to write and 
;---------------------- when I got it, I wondered why I didn't
;---------------------- see it before.  Much cleaner - rÿche
;=========================================
alias dna.fkey.stuff { 
  if (%dna.mp3.fkey != None) { 
    if (%dna.mp3.fkey == $1) { 
      if ($dialog(dna_mp3) != $null) { dialog -v dna_mp3 dna_mp3 } | else { dialog -md dna_mp3 dna_mp3 } 
    }
  }
}
;« the #DNAMP3FKEY is for when you select None in the dialog.  Then this script won't need to bother about fkeys if the user presses one. ».........................
#DNAMP3FKEY on
alias f1 { $dna.fkey.stuff(f1) } 
alias f2 { $dna.fkey.stuff(f2) } 
alias f3 { $dna.fkey.stuff(f3) } 
alias f4 { $dna.fkey.stuff(f4) } 
alias f5 { $dna.fkey.stuff(f5) } 
alias f6 { $dna.fkey.stuff(f6) } 
alias f7 { $dna.fkey.stuff(f7) } 
alias f8 { $dna.fkey.stuff(f8) } 
alias f9 { $dna.fkey.stuff(f9) } 
alias f10 { $dna.fkey.stuff(f10) } 
alias f11 { $dna.fkey.stuff(f11) } 
alias f12 { $dna.fkey.stuff(f12) } 
#DNAMP3FKEY end
;=========================================
;« menus ».........................
;=========================================
menu channel { 
  -
  dna mp3 player v1.2 - by rÿche
  .Launch Player:{  if ($dialog(dna_mp3) != $null) { dialog -v dna_mp3 dna_mp3 }
    else { dialog -md dna_mp3 dna_mp3 } 
  }
  .View ReadMe:run c:\windows\notepad.exe $scriptdir $+ readme.txt
  .-
  .Uninstall Addon:uninstalldnamp3
}
menu status { 
  -
  dna mp3 player v1.2 - by rÿche
  .Launch Player:{  if ($dialog(dna_mp3) != $null) { dialog -v dna_mp3 dna_mp3 }
    else { dialog -md dna_mp3 dna_mp3 } 
  }
  .View ReadMe:run c:\windows\notepad.exe readme.txt
  .-
  .Uninstall Addon:uninstalldnamp3
}