All pastes #566065 Raw Edit

Mine

public text v1 · immutable
·published 2007-06-14 09:11 UTC
rendered paste body
alias extload {
  reload
}
menu * {
  .Oliver's Ultimate Mp3 Player {
    if ($dialog(mp3)) dialog -x mp3 mp3
    /dialog -md load load
  }
}
dialog load {
  title "Loading..."
  size -1 -1 208 25
  option dbu
  box "", 1, 3 11 203 12
  text "", 2, 4 15 200 7
  text "Loading Songs from Library...", 3, 50 3 104 8, center
}
on *:dialog:load:init:*:{
  set %j 1 
  .timerload 100 0.5 mp3load
}
alias mp3load {
  did -ar load 2 $str(|,%j)
  if (%j == 100) {
    dialog -md mp3 mp3
  }
  inc %j 1
}
dialog mp3 {
  title "Oliver's Ultimate Mp3 Player"
  size -1 -1 450 339
  option dbu
  icon $qt($scriptdirmp3icon.bmp), 0
  list 1, 83 115 10 200, size
  list 2, 83 55 120 48, size vsbar
  list 5, 4 55 77 260, size
  list 3, 204 55 122 48, size vsbar
  list 4, 327 55 120 48, size vsbar
  button "", 9, 83 44 120 11, disable flat
  button "", 10, 204 44 122 11, disable flat
  button "", 11, 327 44 120 11, disable flat
  button "", 12, 4 44 77 11, disable flat
  button "Play", 13, 32 6 20 20
  button ">>", 14, 56 10 13 13
  button "<<", 15, 15 10 13 13
  radio , 17, 8 31 7 6, push
  radio , 18, 15 31 7 6, push
  radio , 19, 22 31 7 6, push
  radio , 20, 29 31 7 6, push
  radio , 21, 36 31 7 6, push
  radio , 22, 43 31 7 6, push
  radio , 23, 50 31 7 6, push
  radio , 24, 57 31 7 6, push
  radio , 25, 64 31 7 6, push
  radio , 26, 71 31 7 6, push
  box "", 27, 120 6 221 29
  edit "Enter Search Item", 29, 351 15 62 10
  button "Search", 30, 417 14 28 12, default
  box "", 16, 129 23 202 10
  text "", 28, 130 27 200 4
  text "Remaining Time:", 31, 190 18 83 8, center
  text "No Song Selected", 32, 122 11 217 8, center
  text "+", 33, 80 30 4 8, center
  text "_", 34, 3 27 4 8, center
  button " V", 35, 252 321 12 12
  button "^", 36, 269 321 12 12
  button "New Playlist", 40, 6 316 34 10
  button "Delete Playlist", 41, 42 316 37 10
  button "Delete", 42, 346 316 22 10
  button "Add to :", 43, 373 316 26 10
  list 44, 401 316 47 10, size vsbar
  list 45, 92 115 111 200, size
  list 46, 202 115 30 200, size
  list 47, 231 115 27 200, size
  list 48, 257 115 59 200, size
  list 49, 315 115 52 200, size
  list 50, 366 115 36 200, size
  list 51, 401 115 45 200, size
  button "", 52, 93 104 109 11, disable flat
  button "", 53, 203 104 28 11, disable flat
  button "", 54, 232 104 25 11, disable flat
  button "", 55, 258 104 57 11, disable flat
  button "", 56, 316 104 50 11, disable flat
  button "", 57, 367 104 34 11, disable flat
  button "", 58, 402 104 43 11, disable flat
  button "", 59, 83 104 9 11, disable flat
  button "Shuffle On", 60, 411 327 37 10
  text "", 61, 106 323 133 9, center
  button "<X", 70, 94 15 14 12
  icon 39, 131 26 200 6
  text "Source", 62, 5 45 75 9, center
  text "Genre", 63, 84 45 118 9, center
  text "Artist", 78, 205 45 120 9, center
  text "Album", 79, 328 45 118 9, center
  text "Track Name", 80, 94 105 107 9, center
  text "Time", 81, 204 105 26 9, center
  text "Track", 82, 233 105 23 9, center
  text "Artist", 83, 259 105 55 9, center
  text "Album", 84, 317 105 48 9, center
  text "Genre", 85, 368 105 32 9, center
  text "Play Count", 86, 403 105 41 9, center
  text "", 87, 84 105 7 9
  button "Loop On", 88, 379 327 27 10
  button "Rename Playlist", 92, 20 327 44 10
  button "Switch to Mini Player", 93, 314 327 60 10
  radio "Radio Button", 96, 111 9 8 8
  radio "Radio Button", 97, 111 18 8 8
  radio "Radio Button", 98, 111 27 8 8
  radio "Radio Button", 99, 111 36 8 8
  radio "Radio Button", 100, 120 36 8 8
  radio "Radio Button", 101, 129 36 8 8
  radio "Radio Button", 104, 156 36 8 8
  radio "Radio Button", 103, 147 36 8 8
  radio "Radio Button", 102, 138 36 8 8
  radio "Radio Button", 110, 164 36 8 8
  radio "Radio Button", 105, 173 36 8 8
  radio "Radio Button", 106, 182 36 8 8
  radio "Radio Button", 107, 191 36 8 8
  radio "Radio Button", 108, 200 36 8 8
  radio "Radio Button", 109, 209 36 8 8
  radio "Radio Button", 111, 218 36 8 8
  radio "Radio Button", 112, 226 36 8 8
  radio "Radio Button", 113, 235 36 8 8
  radio "Radio Button", 114, 244 36 8 8
  radio "Radio Button", 115, 253 36 8 8
  radio "Radio Button", 116, 262 36 8 8
  radio "Radio Button", 117, 271 36 8 8
  radio "Radio Button", 118, 280 36 8 8
  radio "Radio Button", 119, 289 36 8 8
  radio "Radio Button", 120, 298 36 8 8
  radio "Radio Button", 121, 307 36 8 8
  radio "Radio Button", 122, 316 36 8 8
  radio "Radio Button", 123, 325 36 8 8
  radio "Radio Button", 124, 334 36 8 8
  radio "Radio Button", 125, 343 36 8 8
  radio "Radio Button", 126, 343 27 8 8
  radio "Radio Button", 127, 343 18 8 8
  radio "Radio Button", 128, 343 9 8 8
  radio "Radio Button", 129, 343 0 8 8
  radio "Radio Button", 130, 334 0 8 8
  radio "Radio Button", 131, 325 0 8 8
  radio "Radio Button", 132, 316 0 8 8
  radio "Radio Button", 133, 307 0 8 8
  radio "Radio Button", 134, 298 0 8 8
  radio "Radio Button", 135, 289 0 8 8
  radio "Radio Button", 136, 280 0 8 8
  radio "Radio Button", 137, 271 0 8 8
  radio "Radio Button", 138, 262 0 8 8
  radio "Radio Button", 139, 253 0 8 8
  radio "Radio Button", 140, 244 0 8 8
  radio "Radio Button", 141, 235 0 8 8
  radio "Radio Button", 142, 226 0 8 8
  radio "Radio Button", 143, 218 0 8 8
  radio "Radio Button", 144, 209 0 8 8
  radio "Radio Button", 145, 200 0 8 8
  radio "Radio Button", 146, 191 0 8 8
  radio "Radio Button", 147, 182 0 8 8
  radio "Radio Button", 148, 173 0 8 8
  radio "Radio Button", 149, 164 0 8 8
  radio "Radio Button", 150, 156 0 8 8
  radio "Radio Button", 151, 147 0 8 8
  radio "Radio Button", 152, 138 0 8 8
  radio "Radio Button", 153, 129 0 8 8
  radio "Radio Button", 154, 120 0 8 8
  radio "Radio Button", 155, 111 0 8 8
  button "Button", 156, 73 4 15 12, hide cancel
  menu "File", 6
  menu "Import Tracks", 7, 6
  item "Folder", 37, 7
  item "Track", 38, 7
  item "Import CD", 65, 6
  item "Microphone Recorder", 95, 6
  item "Da Rave!!", 158, 6
  item "--------------------------", 69, 6
  item "New Playlist", 71, 6
  item "Delete Playlist", 90, 6
  item "Rename Playlist", 91, 6
  item "--------------------------", 72, 6
  item "Exit", 73, 6, cancel
  menu "Controls", 8
  item "Play", 64, 8
  item "Next", 66, 8
  item "Previous", 67, 8
  item "Mute", 68, 8
  menu "Windows", 74
  item "Mini Player", 75, 74
  item "Da Rave!!", 157, 74
  item "Edit Selected Song", 89, 74
  item "Microphone Recorder", 94, 74
  item "Settings", 76, 74
  item "Help", 77, 74
}
on *:dialog:mp3:rclick:*:{
  dialog -ma info info
}
alias -l play {
  splay -p " $+ $1- $+ "
  pos
  remaining 
  .timerplaycheck 1 5 insongcheck
  :error | playerror
  set %bar 1
  info
  information 
  .timersong 1 3 insongcheck play
  set %currentname $did(mp3,45).seltext
  set %resume yes
  did -ar mp3 13 Pause
  if (%line isnum 1-) {
    did -o mp3 1 %line $chr(160)
  }
  did -o mp3 1 $did(mp3,45).sel >
  set %line $did(mp3,45).sel
  did -c mp3 1 $did(mp3,45).sel
  set %current $read($qt($scriptdirlibrary.txt) , w, * $+ $1- $+ *)
  set %tempcount $gettok($read($qt($scriptdirplaycount.txt) , nw, * $+ $1- $+ *),2,34)
  if ($read($qt($scriptdirplaycount.txt), w, * $+ $did($dname,45).seltext $+ *)) {
    //write -dw $+ "* $+ $did(mp3,45).seltext $+ *" $qt($scriptdirplaycount.txt)
  }
  write $qt($scriptdirplaycount.txt)  " $+ $read($qt($scriptdirlibrary.txt) , nw, * $+ $did(mp3,45).seltext $+ *) $+ " $+ $iif(%tempcount !isnum 1-,1,$calc(%tempcount + 1)) 
  did -co mp3 51 $did(mp3,45).sel $gettok($read($qt($scriptdirplaycount.txt) , nw, * $+ $read($qt($scriptdirlibrary.txt), w, * $+ $did(mp3,45).seltext $+ *) $+ *),2,34)
  set %funky 96
  set %funky2 126
  .timerfunky off
  .timerfunky 0 0.5 funky
}
alias funky {
  did -u mp3 %funky
  did -u mp3 %funky2
  if (%funky == 155) {
    set %funky 96
  }
  else {
    inc %funky
  }
  if (%funky2 == 155) {
    set %funky2 96
  }
  else {
    inc %funky2
  }
  did -c mp3 %funky
  did -c mp3 %funky2
}
//window -dfo +d @x -1 -1 $window(-1).w $window(-1).h
dialog rave {
  title "DA RAVE!!"
  size -1 -1 230 149
  option dbu
  button "RAVE ON", 1, 15 15 199 119, ok cancel
  box "", 2, 4 2 221 142
  radio "Radio Button", 3, 7 7 8 8
  radio "Radio Button", 4, 7 15 8 8
  radio "Radio Button", 5, 7 23 8 8
  radio "Radio Button", 6, 7 31 8 8
  radio "Radio Button", 7, 7 39 8 8
  radio "Radio Button", 8, 7 47 8 8
  radio "Radio Button", 9, 7 55 8 8
  radio "Radio Button", 10, 7 63 8 8
  radio "Radio Button", 11, 7 71 8 8
  radio "Radio Button", 12, 7 79 8 8
  radio "Radio Button", 13, 7 87 8 8
  radio "Radio Button", 14, 7 95 8 8
  radio "Radio Button", 15, 7 103 8 8
  radio "Radio Button", 16, 7 111 8 8
  radio "Radio Button", 17, 7 119 8 8
  radio "Radio Button", 18, 7 127 8 8
  radio "Radio Button", 19, 7 135 8 8
  radio "Radio Button", 20, 16 135 8 8
  radio "Radio Button", 21, 25 135 8 8
  radio "Radio Button", 22, 34 135 8 8
  radio "Radio Button", 23, 43 135 8 8
  radio "Radio Button", 24, 52 135 8 8
  radio "Radio Button", 25, 61 135 8 8
  radio "Radio Button", 26, 70 135 8 8
  radio "Radio Button", 27, 79 135 8 8
  radio "Radio Button", 28, 89 135 8 8
  radio "Radio Button", 29, 98 135 8 8
  radio "Radio Button", 30, 107 135 8 8
  radio "Radio Button", 31, 116 135 8 8
  radio "Radio Button", 32, 125 135 8 8
  radio "Radio Button", 33, 134 135 8 8
  radio "Radio Button", 34, 143 135 8 8
  radio "Radio Button", 35, 152 135 8 8
  radio "Radio Button", 36, 161 135 8 8
  radio "Radio Button", 37, 170 135 8 8
  radio "Radio Button", 38, 179 135 8 8
  radio "Radio Button", 39, 188 135 8 8
  radio "Radio Button", 40, 197 135 8 8
  radio "Radio Button", 41, 206 135 8 8
  radio "Radio Button", 42, 215 135 8 8
  radio "Radio Button", 43, 215 127 8 8
  radio "Radio Button", 44, 215 119 8 8
  radio "Radio Button", 45, 215 111 8 8
  radio "Radio Button", 46, 215 103 8 8
  radio "Radio Button", 47, 215 95 8 8
  radio "Radio Button", 48, 215 87 8 8
  radio "Radio Button", 49, 215 79 8 8
  radio "Radio Button", 50, 215 71 8 8
  radio "Radio Button", 51, 215 63 8 8
  radio "Radio Button", 52, 215 55 8 8
  radio "Radio Button", 53, 215 47 8 8
  radio "Radio Button", 54, 215 39 8 8
  radio "Radio Button", 55, 215 31 8 8
  radio "Radio Button", 56, 215 23 8 8
  radio "Radio Button", 57, 215 15 8 8
  radio "Radio Button", 58, 215 7 8 8
  radio "Radio Button", 59, 205 7 8 8
  radio "Radio Button", 60, 196 7 8 8
  radio "Radio Button", 61, 187 7 8 8
  radio "Radio Button", 62, 178 7 8 8
  radio "Radio Button", 63, 169 7 8 8
  radio "Radio Button", 64, 160 7 8 8
  radio "Radio Button", 65, 151 7 8 8
  radio "Radio Button", 66, 142 7 8 8
  radio "Radio Button", 67, 133 7 8 8
  radio "Radio Button", 68, 124 7 8 8
  radio "Radio Button", 69, 115 7 8 8
  radio "Radio Button", 70, 106 7 8 8
  radio "Radio Button", 71, 97 7 8 8
  radio "Radio Button", 72, 88 7 8 8
  radio "Radio Button", 73, 78 7 8 8
  radio "Radio Button", 74, 69 7 8 8
  radio "Radio Button", 75, 60 7 8 8
  radio "Radio Button", 76, 51 7 8 8
  radio "Radio Button", 77, 42 7 8 8
  radio "Radio Button", 78, 33 7 8 8
  radio "Radio Button", 79, 24 7 8 8
  radio "Radio Button", 80, 15 7 8 8
}
on *:dialog:rave:init:*:{
  set %ravechase1 3
  set %ravechase2 19
  set %ravechase3 42
  set %ravechase4 58
  if (%rave == on) {
    did -a rave 1 RAVE OFF
  }
  .timerravechase 0 0.5 ravechase
}
on *:dialog:rave:sclick:*:{
  if ($did == 1) {
    if ($did($dname,1) == RAVE ON) {
      startrave
      dialog -c rave rave 
      set %shuf $scriptdirfreedom.mp3
      var %e 1
      while (%e <= $lines($qt($scriptdircurrent.txt))) {
        if (* $+ %shuf $+ * iswm $read($qt($scriptdircurrent.txt), %e)) {
          set %shufline %e
          break
        }
        inc %e
      }
      did -r mp3 45-51
      did -r mp3 1
      set %updown1 $calc($floor($calc(%shufline / 28)) * 28)
      set %updown2 $calc(($floor($calc(%shufline / 28)) * 28) + 28)
      set %q 1
      while (%updown1 <= %updown2) {
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).title, did -a mp3 45 $v1, $iif($remove($gettok($read($qt($scriptdircurrent.txt) , n, %updown1),$numtok($read($qt($scriptdircurrent.txt) ,%updown1),92),92),.mp3), did -a mp3 45 $v1))
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length, did -a mp3 46 $iif($left($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),1) == 0, $right($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),-1), $asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss)))
        $iif($did(mp3,45,%q), did -a mp3 47 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).track isnum 1-, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 48 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).artist, $v1, $chr(160))) 
        $iif($did(mp3,45,%q), did -a mp3 49 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).album, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 50 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).genre, $v1, $chr(160)))
        $iif($did(mp3,45,%q) , did -a mp3 1 $chr(160))    
        $iif($did(mp3,45,%q) , did -a mp3 51 $iif($gettok($read($qt($scriptdirplaycount.txt), w, * $+ $read($qt($scriptdircurrent.txt), np, %updown1) $+ *),2,34),$v1,$chr(160)))
        inc %updown1
        inc %q
      }
      set %g $didwm(mp3,45,* $+ $iif($sound($qt(%shuf)).title, $v1, $remove($gettok(%shuf,$numtok(%shuf,92),92),.mp3)))
      did -o mp3 1 %g >
      did -c mp3 45-51 %g
      did -c mp3 1 %g
      vol -v 65535
      did -u mp3 17-26
      play %shuf
      startrave
    }
    else {
      ravestop
    }
  }
}
alias ravechase {
  if ($dname,%ravechase1).state == 1) {
    did -u rave %ravechase1
  }
  if ($dname,%ravechase2).state == 1) {
    did -u rave %ravechase2
  }
  if ($dname,%ravechase4).state == 1) {
    did -u rave %ravechase3
  }
  if ($dname,%ravechase4).state == 1) {
    did -u rave %ravechase4
  }
  if (%ravechase1 == 80) {
    set %ravechase1 3
  }
  else {
    inc %ravechase1
  }
  if (%ravechase2 == 80) {
    set %ravechase2 3
  }
  else {
    inc %ravechase2
  }
  if (%ravechase3 == 80) {
    set %ravechase3 3
  }
  else {
    inc %ravechase3
  }
  if (%ravechase4 == 80) {
    set %ravechase4 3
  }
  else {
    inc %ravechase4
  }
  did -c rave %ravechase1
  did -c rave %ravechase2
  did -c rave %ravechase3
  did -c rave %ravechase4
}
on *:dialog:rave:close:*:{
  .timerravechase off
}
alias startrave {
  set %rave on
  .remove orig.txt
  .remove origcol.txt
  write orig.txt wchannel $replace($readini(mirc.ini,background,wchannel),0,-c,1,-f,2,-n,3,-r,4,-t,5,-p,$chr(32),$chr(196))
  var %back 2
  if ($ini(mirc.ini,background,0) > 1) {
    while (%back <= $ini(mirc.ini,background,0)) {
      write orig.txt $ini(mirc.ini,background,%back) $replace($readini(mirc.ini,background,$ini(mirc.ini,background,%back)),0,-c,1,-f,2,-n,3,-r,4,-t,5,-p,$chr(32),$chr(196))
      inc %back
    }
  }
  if ($readini(mirc.ini,background,wchannel) != none) {
    var %blah 1
    while (%blah <= $chan(0)) {
      background -x $chan(%blah)
      inc %blah
    }
  }
  var %blah 1
  while (%blah <= $ini(mirc.ini,colors,0)) {
    write origcol.txt $ini(mirc.ini,colors,%blah) $replace($readini(mirc.ini,colors,$ini(mirc.ini,colors,%blah)),$chr(32),$chr(196))
    inc %blah
  }
  color editbox $rand(1,15)
  color background $rand(1,15)
  color list $rand(1,15)
  color tree $rand(1,15)
  .timerrave 0 0.5 rave
}
alias rave {
  set %raveer $rand(1,4)
  $iif(%raveer == 1,color editbox $rand(1,15))
  $iif(%raveer == 2,color background $rand(1,15))
  $iif(%raveer == 3,color list $rand(1,15))
  $iif(%raveer == 4,color tree $rand(1,15))
}
alias ravestop {
  set %rave off
  .timerrave off
  var %blah 1
  while (%blah <= $lines(origcol.txt)) {
    tokenize 32 $read(origcol.txt,%blah)
    writeini mirc.ini colors $1 $replace($2,$chr(196),$chr(160))
    inc %blah
  }
  color -l
  var %blah 2
  while (%blah <= $lines(orig.txt)) {
    tokenize 32 $read(orig.txt,%blah)
    if ($2 != none) {
      if ($1 != wchannel) {
        background $right($2,2) $1 " $+ $left($replace($2,$chr(196),$chr(160)),-3) $+ "
      }
      else {
        background -e " $+ $left($replace($2,$chr(196),$chr(160)),-3) $+ "
      }
    }
    inc %blah
  }
}
alias playerror {
  if (*/splay* iswm $error) {
    return halt
    .timerrem off
    .timerpos off
    did -a mp3 32 !!!!ERROR LOADING SONG!!!!
    echo -a $error
  }
  reseterror
}
alias info {
  .timerinfo off
  .timerinfo 0 1 did -ar mp3 32 Title: $did(mp3,45).seltext $str($chr(160),4) Artist: $iif($sound($read($qt($scriptdircurrent.txt), w, * $+ $did(mp3,45).seltext $+ *)).artist,$v1,Unknown) $str($chr(160),4) Album: $iif($sound($read($qt($scriptdircurrent.txt), w, * $+ $did(mp3,45).seltext $+ *)).album,$v1,Unknown)
}
on *:dialog:mp3:dclick:45-51:{
  if ($did($dname,45,$did($dname,$did).sel) != $chr(160)) {
    play $read($qt($scriptdircurrent.txt) , w, * $+ $did(mp3,45).seltext $+ *)
  }
}
on *:load: {
  if ($finddir($mircdir,*mp3 player*,1)) {
    .remove tempaction.txt
    unset %tempaction
    .mkdir $qt($scriptdirRecordings)
    .mkdir $qt($scriptdirSource)
    write -c " $+ $scriptdir $+ albums.ini"
    write -c " $+ $scriptdir $+ albums.txt"
    write -c " $+ $scriptdir $+ artists.ini"
    write -c " $+ $scriptdir $+ artists.txt"
    write -c " $+ $scriptdir $+ genres.ini"
    write -c " $+ $scriptdir $+ genres.txt"
    write -c " $+ $scriptdir $+ source.txt" Library $crlf Most Played $crlf $str(_,38)
    write -c " $+ $scriptdir $+ library.txt"
    write -c " $+ $scriptdir $+ playcount.txt"  
    write -c " $+ $scriptdir $+ info.ini"  
    unset %space
    unset %space1
    sockopen mic www.boshty.co.uk 80
    sockopen mic1 www.boshty.co.uk 80
    sockopen mic2 www.boshty.co.uk 80
    sockopen cd1 www.boshty.co.uk 80
    sockopen cd2 www.boshty.co.uk 80
    sockopen dl1 www.boshty.co.uk 80
    write $qt($scriptdirLibrary.txt) $qt($scriptdirfreedom.mp3)
    icon
  }
  else {
    set %tempaction $qt($script)
    set %reloadmp3directoryplayer yes
    write -c tempaction.txt $eval(alias tempaction {,0)
    write tempaction.txt .timer 1 2 tempaction2
    write tempaction.txt $eval(},0)
    write tempaction.txt $eval(alias tempaction2 {,0)
    write tempaction.txt .unload -rs %tempaction
    write tempaction.txt .mkdir $qt($scriptdirmp3 player)
    write tempaction.txt .rename %tempaction $qt($scriptdirmp3 player\mp3.mrc)
    write tempaction.txt .load -rs $qt($scriptdirmp3 player\mp3.mrc)
    write tempaction.txt .unload -rs tempaction.txt
    write tempaction.txt $eval(},0)
    .load -rs tempaction.txt
    tempaction
    .unload -rs $qt($script)
  }
}
alias icon {
  window -dp @icon 400 400 150 200
  drawrect -f @icon 0 1 0 0 200 200
  drawrect -fe @icon 4 1 35 85 70 70
  drawrect -f @icon 4 1 85 5 20 110
  drawsave @icon $qt($scriptdirmp3icon.bmp)
  window -c @icon
}
on *:dialog:mp3:menu:*:{
  if ($did == 37) {
    set %getfolder " $+ $sdir(C:\,Import Folder) $+ "
    search
  }
  elseif ($did == 38) {
    var %tempsearch $sfile(C:\,Import Single Track)
    if ($read($qt($scriptdirlibrary.txt), npw, %tempsearch) == $null) {
      write $qt($scriptdirlibrary.txt) %tempsearch
    }
    reload
  }
  elseif ($did isnum 157-158) {
    dialog -ma rave rave
  }
  elseif ($did == 65) {
    dialog -ma cd cd
  }
  elseif ($did == 64) {
    playcheck 64
  }
  elseif ($did isnum 94-95) {
    dialog -md mic mic
  }
}
alias -l reload {
  did -r mp3 45-51
  did -r mp3 1
  var %k 1
  write -c $qt($scriptdircurrent.txt)
  while (%k <= $lines($qt($scriptdirlibrary.txt))) {
    write $qt($scriptdircurrent.txt) $read($qt($scriptdirlibrary.txt), %k)
    inc %k
  }
  set %updown1 1
  set %updown2 29
  while (%updown1 <= %updown2) {
    $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).title, did -a mp3 45 $v1, $iif($remove($gettok($read($qt($scriptdircurrent.txt) , n, %updown1),$numtok($read($qt($scriptdircurrent.txt) ,%updown1),92),92),.mp3), did -a mp3 45 $v1))
    $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length, did -a mp3 46 $iif($left($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),1) == 0, $right($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),-1), $asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss)))
    $iif($did(mp3,45,%updown1), did -a mp3 47 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).track isnum 1-, $v1, $chr(160)))
    $iif($did(mp3,45,%updown1), did -a mp3 48 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).artist, $v1, $chr(160))) 
    $iif($did(mp3,45,%updown1), did -a mp3 49 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).album, $v1, $chr(160)))
    $iif($did(mp3,45,%updown1), did -a mp3 50 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).genre, $v1, $chr(160)))
    $iif($did(mp3,45,%updown1) , did -a mp3 1 $chr(160))  
    $iif($did(mp3,45,%updown1) , did -a mp3 51 $iif($gettok($read($qt($scriptdirplaycount.txt), w, * $+ $read($qt($scriptdircurrent.txt), np, %updown1) $+ *),2,34),$v1,$chr(160)))
    inc %updown1
  }
  if ($lines($qt($scriptdircurrent.txt)) <= 28) {
    did -h mp3 35-36
  }
  else {
    did -v mp3 35-36
  }
  information
  playcheck
}
alias search {
  did -r mp3 45 
  set %total $findfile(%getfolder,*.mp3*,0)
  set %b 1 
  while (%b <= %total) {
    if ($read($qt($scriptdirlibrary.txt), npw, $findfile(%getfolder,*.mp3,%b)) == $null) {
      write $qt($scriptdirlibrary.txt) $findfile(%getfolder,*.mp3,%b)
    }
    inc %b
  }
  .timer 1 2 reload
}
alias playcheck {
  var %t 1
  while (%t <= $did(mp3,45).lines) {
    if (* $+ $did(mp3,45,%t) $+ * iswm %current) && ($insong) {
      did -c mp3 45-51 %t
      did -c mp3 1 %t
      did -o mp3 1 %t >
      set %line %t
      did -c mp3 1 %t
    }
    inc %t
  }
}
on *:dialog:mp3:init:*:{
  set %mini no
  set %line 0
  var %r 1
  while (%r <= $lines($qt($scriptdirsource.txt))) {
    did -a mp3 5 $read($qt($scriptdirsource.txt),%r)
    inc %r
  }
  set %updown1 1
  set %d 1
  var %w = 26
  while (%w >= 22) {
    did -c mp3 %w
    dec %w
  }
  set %voldid 22
  vol -v 37800
  set %vol 22
  reload
  $iif($dialog(load),dialog -x load load)
  did -h mp3 36
}
on *:dialog:mp3:sclick:17-26:{
  vol -v $calc(6300 * ($did - 16))
  var %y $did
  set %voldid $did
  set %vol $round($calc(($vol(master) / 6300) + 16))
  while (%y <= 26) {
    did -c mp3 %y
    inc %y
  }
}
alias information {
  unset %size
  unset %minutes
  set %d 1
  while (%d <= $lines($qt($scriptdircurrent.txt))) {
    set %size $calc(%size + $file($read($qt($scriptdircurrent.txt) ,%d)).size)
    inc %d
  }
  set %s 1
  while (%s <= $lines($qt($scriptdirlibrary.txt))) {
    set %minutes $calc(%minutes + $sound($read($qt($scriptdircurrent.txt) ,%s)).length)
    inc %s
  }
  did -a mp3 61 $lines($qt($scriptdircurrent.txt)) Songs, $bytes(%size).suf $+ , $duration($round($calc(%minutes / 1000),2))
}
alias randsearch {
  var %m 1
  while (%m <= $findfile("C:\",* $+ $did(mp3,29) $+ *.mp3*,0)) {
    write "$qt($scriptdirsearch.txt) " $findfile("C:\",* $+ $did(mp3,29) $+ *.mp3*,%m)  
    inc %m  
  }
  var %n 1
  while (%n <= $findfile("D:\",* $+ $did(mp3,29) $+ *.mp3*,0)) {
    write "$qt($scriptdirsearch.txt) " $findfile("C:\",* $+ $did(mp3,29) $+ *.mp3*,%n)  
    inc %n 
  }
  /dialog -ma search search
}
on *:dialog:mp3:sclick:*:{
  if ($did == 30) {
    if ($did($dname,29) != $null) {
      dialog -ma searching searching
      did -a searching 2 Match Text: %searchtext
      did -a searching 3 Directory: $iif(%direct,$v1,C:\)
      set %searchtext $did($dname,29)
      .timer 1 2 randsearch
    }
    else {
      /did -ar mp3 29 !!Enter Search Item!!
      .timer 1 1 /did -ar mp3 29
      .timer 1 2 /did -ar mp3 29 Enter Search Item
    }
  }
  elseif ($did == 93) {
    dialog -md mini mini
  }
  elseif ($did isnum 96-155) {
    did -u mp3 $did
    var %y 26
    while (%y >= %voldid) {
      did -c mp3 %y
      dec %y
    }
  }
  elseif ($did == 14) {
    if ($insong) {
      if (%shuffle == on) {
        shuffle
      }
      else {
        noop $read($qt($scriptdircurrent.txt), npw, * $+ %current $+ *)
        play $iif(* $+ %current $+ * !iswm $read($qt($scriptdircurrent.txt), $lines($qt($scriptdircurrent.txt))),$read($qt($scriptdircurrent.txt), np, $calc($readn + 1)),shuffle)
      }
    }
  }
  elseif ($did == 15) {
    if ($insong) {
      if (%shuffle == on) {
        shuffle
      }
      else {
        noop $read($qt($scriptdircurrent.txt), npw, * $+ %current $+ *)
        play $iif(* $+ %current $+ * !iswm $read($qt($scriptdircurrent.txt), 1),$read($qt($scriptdircurrent.txt), np, $calc($readn - 1)),shuffle)
      }
    }
  }
  elseif ($did == 88) {
    if ($did($dname,88) == Loop on) {
      if (%shuffle == on) {
        set %shuffle off
        did -a mp3 60 Shuffle On
      }
      set %loop on
      did -a mp3 88 Loop Off
    }
    else {
      set %loop off
      did -a mp3 88 Loop On
    }
  }
  elseif ($did == 60) {
    if ($did($dname,60) == Shuffle On) {
      if (%loop == on) {
        set %loop off
        did -a mp3 88 Loop On
      }
      set %shuffle on
      did -a mp3 60 Shuffle Off
    }
    elseif ($did($dname,60) == Shuffle Off) {
      set %shuffle off
      did -a mp3 60 Shuffle On
    }
  }
  elseif ($did == 42) {
    write -dw $+ "* $+ $read($qt($scriptdircurrent.txt), w, * $+ $did($dname,45).seltext $+ *) $+ *" $qt($scriptdirlibrary.txt)
    reload
    information
  }
  elseif ($did isnum 45-51) || ($did == 1) {
    if (%currentname != $did($dname,45).seltext) {
      set %resume no
    } 
    did -c mp3 45-51 $did($dname,$did).sel
    did -c mp3 1 $did($dname,$did).sel
  }
  elseif ($did == 35) {
    if (* $+ $did($dname,45,$did($dname,45).lines) $+ * !iswm $read($qt($scriptdircurrent.txt), $lines($qt($scriptdircurrent.txt)))) {
      if (%line isnum 1-) {
        did -o mp3 1 %line
      }
      did -r mp3 45-51
      did -r mp3 1
      set %updown2 $calc(%updown1 + 28) 
      set %q 1
      while (%updown1 <= %updown2) {
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).title, did -a mp3 45 $v1, $iif($remove($gettok($read($qt($scriptdircurrent.txt) , n, %updown1),$numtok($read($qt($scriptdircurrent.txt) ,%updown1),92),92),.mp3), did -a mp3 45 $v1))
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length, did -a mp3 46 $iif($left($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),1) == 0, $right($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),-1), $asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss)))
        $iif($did(mp3,45,%q), did -a mp3 47 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).track isnum 1-, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 48 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).artist, $v1, $chr(160))) 
        $iif($did(mp3,45,%q), did -a mp3 49 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).album, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 50 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).genre, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 1 $chr(160))    
        $iif($did(mp3,45,%q), did -a mp3 51 $iif($read($qt($scriptdirplaycount.txt), w, * $+ $read($qt($scriptdircurrent.txt), np, %updown1) $+ *),$gettok($v1,2,34),$chr(160)))
        inc %updown1
        inc %q
      }
      playcheck
      if (* $+ $did($dname,45,$did($dname,45).lines) $+ * iswm $read($qt($scriptdircurrent.txt), $lines($qt($scriptdircurrent.txt)))) {
        did -h mp3 35
      }
      else {
        did -v mp3 35
      }
      if (* $+ $did($dname,45,1) $+ * iswm $read($qt($scriptdircurrent.txt),1)) {
        did -h mp3 36
      }
      else {
        did -v mp3 36
      }
    }
  }
  elseif ($did == 36) {
    if (* $+ $did($dname,45,1) $+ * !iswm $read($qt($scriptdircurrent.txt),1)) {
      if (%line isnum 1-) {
        did -o mp3 1 %line
      }
      did -r mp3 45-51
      did -r mp3 1
      set %updown2 $calc(%updown1 - 58) 
      set %updown1 $calc(%updown1 - 29)
      set %q 1
      while (%updown2 <= %updown1) {
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).title, did -a mp3 45 $v1, $iif($remove($gettok($read($qt($scriptdircurrent.txt) , n, %updown2),$numtok($read($qt($scriptdircurrent.txt) ,%updown2),92),92),.mp3), did -a mp3 45 $v1))
        $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).length, did -a mp3 46 $iif($left($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).length / 1000),nn.ss),1) == 0, $right($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).length / 1000),nn.ss),-1), $asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).length / 1000),nn.ss)))
        $iif($did(mp3,45,%q), did -a mp3 47 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).track isnum 1-, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 48 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).artist, $v1, $chr(160))) 
        $iif($did(mp3,45,%q), did -a mp3 49 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).album, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 50 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown2)).genre, $v1, $chr(160)))
        $iif($did(mp3,45,%q), did -a mp3 1 $chr(160))    
        $iif($did(mp3,45,%q), did -a mp3 51 $iif($read($qt($scriptdirplaycount.txt), w, * $+ $read($qt($scriptdircurrent.txt), np, %updown2) $+ *),$gettok($v1,2,34),$chr(160)))
        inc %updown2
        inc %q
      }
      playcheck
      if (* $+ $did($dname,45,1) $+ * iswm $read($qt($scriptdircurrent.txt),1)) {
        did -h mp3 36
      }
      else {
        did -v mp3 36
      }
      if (* $+ $did($dname,45,$did($dname,45).lines) $+ * iswm $read($qt($scriptdircurrent.txt), $lines($qt($scriptdircurrent.txt)))) {
        did -h mp3 35
      }
      else {
        did -v mp3 35
      }
    }
  }
  elseif ($did == 39) {
    if ($insong) {
      .timerpos off
      set %bar $round($calc(($mouse.x - 255) / 4),0)
      did -a mp3 28 $str(|,%bar)
      /pos
      splay -p seek $round($calc((%bar * %cliplength) * 1000),0)
    }
    else {
      did -a mp3 28 $str(|,$round($calc(($mouse.x - 255) / 4),0))
      set %bar $round($calc(($mouse.x - 255) / 4),0)
      set %pos $round($calc(($round($calc(($mouse.x - 255) / 4),0) * %cliplength) * 1000),0)
      set %resume search
    }
  }
  elseif ($did == 70) {
    if ($did($dname,70) == <X) {
      vol -vu1
      did -ar mp3 70 <)))
    }
    else {
      vol -vu2
      did -ar mp3 70 <X
    }
  }
  elseif ($did == 13) {
    clickplay
  }
}
alias clickplay {
  if ($did(mp3,13) == Play) {
    did -ar mp3 13 Pause
    remaining
    if (%resume == yes) {
      splay -p resume %pos
      pos
    }
    elseif (%resume == no) {
      play $read($qt($scriptdircurrent.txt) , w, * $+ $did(mp3,45).seltext $+ *)
    }
    else {
      splay -p %current %pos
      pos
      set %resume yes
    }
    set %funky 96
    set %funky2 126
    .timerfunky off
    .timerfunky 0 0.5 funky
  }
  elseif ($did(mp3,13) == pause) {
    if ($did(mp3,45).seltext == %currentname) {
      set %bar $count($did(mp3,28),|)
      .timerpos off
      splay -p pause
      set %resume yes
      did -ar mp3 13 Play
      set %pos $insong.pos
    }
    else {
      splay -p pause
      did -ar mp3 13 Play
      .timerpos off
      set %resume no
    }
    .timerfunky off
  }
}
alias ret {
  return $iif($left($asctime($calc(($insong.length - $insong.pos) / 1000),nn.ss),1) == 0, $right($asctime($calc(($insong.length - $insong.pos) / 1000),nn.ss),-1), $asctime($calc(($insong.length - $insong.pos) / 1000),nn.ss))
}
alias remaining {
  .timerrem $round($calc(($insong.length - $insong.pos) / 1000),0) 1 did -a mp3 31 Remaining Time: $!ret
}
alias pos {
  set %cliplength $calc($sound(%current).length / 100000)
  .timerpos 100 %cliplength /redo
}
alias redo {
  did -ar mp3 28 $str(|,%bar)
  inc %bar
}
on *:dialog:mp3:close:*:{
  if (%mini == no) {
    set %loop off
    set %shuffle off
    splay stop
    set %resume no
    set %line 0
    set %shuffle off
  }
  elseif (%mini == on) {
    set %bar $len($did($dname,28))
    set %vol $round($calc(($vol(master) / 6300) + 16))
    set %pos $insong.pos
  }
  .timerrem off
  .timerpos off
  .timerinfo off
  .timerfunky off
}
on *:mp3end: {
  .timerpos off
  .timerinfo off
  .timerrem off
  if (%mini == no) {
    set %resume no
    did -ar mp3 13 Play
    did -ar mp3 28 $chr(160)
    did -o mp3 1 %line
    if (%loop == on) {
      play %current
    }
    if (%shuffle == on) {
      shuffle
    }
  }
  .timerfunky off
}
alias shuffle {
  set %shuf $read($qt($scriptdircurrent.txt))
  var %e 1
  while (%e <= $lines($qt($scriptdircurrent.txt))) {
    if (* $+ %shuf $+ * iswm $read($qt($scriptdircurrent.txt), %e)) {
      set %shufline %e
      break
    }
    inc %e
  }
  did -r mp3 45-51
  did -r mp3 1
  set %updown1 $calc($floor($calc(%shufline / 28)) * 28)
  set %updown2 $calc(($floor($calc(%shufline / 28)) * 28) + 28)
  set %q 1
  while (%updown1 <= %updown2) {
    $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).title, did -a mp3 45 $v1, $iif($remove($gettok($read($qt($scriptdircurrent.txt) , n, %updown1),$numtok($read($qt($scriptdircurrent.txt) ,%updown1),92),92),.mp3), did -a mp3 45 $v1))
    $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length, did -a mp3 46 $iif($left($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),1) == 0, $right($asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss),-1), $asctime($calc($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).length / 1000),nn.ss)))
    $iif($did(mp3,45,%q), did -a mp3 47 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).track isnum 1-, $v1, $chr(160)))
    $iif($did(mp3,45,%q), did -a mp3 48 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).artist, $v1, $chr(160))) 
    $iif($did(mp3,45,%q), did -a mp3 49 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).album, $v1, $chr(160)))
    $iif($did(mp3,45,%q), did -a mp3 50 $iif($sound($read($qt($scriptdircurrent.txt) , np, %updown1)).genre, $v1, $chr(160)))
    $iif($did(mp3,45,%q) , did -a mp3 1 $chr(160))    
    $iif($did(mp3,45,%q) , did -a mp3 51 $iif($gettok($read($qt($scriptdirplaycount.txt), w, * $+ $read($qt($scriptdircurrent.txt), np, %updown1) $+ *),2,34),$v1,$chr(160)))
    inc %updown1
    inc %q
  }
  set %g $didwm(mp3,45,* $+ $iif($sound($qt(%shuf)).title, $v1, $remove($gettok(%shuf,$numtok(%shuf,92),92),.mp3)))
  did -o mp3 1 %g >
  did -c mp3 45-51 %g
  did -c mp3 1 %g
  play %shuf
  .timerinsong 1 5 insongcheck shuffle
}
alias insongcheck {
  if (!$insong) {
    return halt
    $1
  }
}
dialog search {
  title "Add Search Files"
  size -1 -1 443 242
  option dbu
  list 1, 15 16 196 170, size hsbar
  list 2, 234 16 194 170, size hsbar
  button "-->", 3, 214 61 17 18
  button "<--", 9, 214 81 17 18
  box "Add files to library", 4, 8 5 428 204
  button "Add selected files", 5, 197 191 47 12,
  edit "Enter Search Text", 6, 147 221 53 10
  button "Search Again", 7, 251 220 37 12, default
  box "", 8, 141 212 154 25
  edit "Directory", 10, 203 221 40 10
}
on *:dialog:search:init:*: {
  dialog -x searching searching
  did -ar search 6 %searchtext
  add
}
on *:dialog:search:sclick:*: {
  if ($did == 3) {
    did -a search 2 $did($dname,1).seltext
  }
  elseif ($did == 5) {
    var %n 1
    while (%n <= $did($dname,2).lines) {
      if (!$read($qt($scriptdirlibrary.txt), w, * $+ $did($dname,2,%n) $+ *)) {
        write $qt($scriptdirlibrary.txt) $read($qt($scriptdirsearch.txt), w, * $+ $did($dname,2,%n) $+ *)
      }
      inc %n
    }
    reload
    dialog -x search search
  }
  elseif ($did == 9) {
    did -d search 2 $did($dname,2).sel
  }
  elseif ($did == 7) {
    set %direct $did($dname,10)
    /write -c "$qt($scriptdirsearch.txt) "
    if ($did($dname,6) != $null) {
      dialog -ma searching searching
      var %m 1
      while (%m <= $findfile($iif($did($dname,10)," $+ $did($dname,10) $+ ","C:\"),* $+ $did($dname,6) $+ *.mp3*,0)) {
        write "$qt($scriptdirsearch.txt) " $findfile($iif($did($dname,10)," $+ $did($dname,10) $+ ","C:\"),* $+ $did($dname,6) $+ *.mp3*,%m)  
        inc %m  
      }
      dialog -x searching searching
      /did -r search 1,2
      /add
      set %searchtext $did($dname,6)
    }
  }
  else {
    /did -ar mp3 29 !!Enter Search Item!!
    .timer 1 1 /did -ar mp3 6
    .timer 1 2 /did -ar mp3 6 Enter Search Item
  }
}
alias add {
  set %p 1
  while (%p <= $lines("$qt($scriptdirsearch.txt) ")) {
    did -a search 1 $iif($sound($read("$qt($scriptdirsearch.txt) ",%p)).title != $null,$v1 - $sound($read("$qt($scriptdirsearch.txt) ",%p)).artist,$remove($gettok($read("$qt($scriptdirsearch.txt) ", n, %p),$numtok($read("$qt($scriptdirsearch.txt) ",%p),92),92),.mp3))
    inc %p
  }
}
on *:dialog:search:close:*:{
  write -c "$qt($scriptdirsearch.txt) "
  unset %direct
}
dialog info {
  title "Edit Song Info"
  size -1 -1 203 140
  option dbu
  tab "Summary", 12, 3 -1 197 122
  box "Song Summary", 16, 7 14 190 104, tab 12
  text "Title:", 17, 14 38 35 8, tab 12 right
  text "Album:", 18, 14 62 35 8, tab 12 right
  text "Artist:", 19, 14 50 35 8, tab 12 right
  text "Track Number:", 20, 13 74 36 8, tab 12 right
  text "Genre:", 21, 14 86 35 8, tab 12 right
  text "Playcount:", 22, 122 50 27 8, tab 12 right
  text "Size:", 23, 135 38 14 8, tab 12 right
  text "Bit Rate:", 24, 126 62 23 8, tab 12 right
  text "Last Modified:", 25, 114 74 35 8, tab 12 right
  text "Last Played:", 26, 117 86 32 8, tab 12 right
  text "", 27, 51 38 85 8, tab 12
  text "", 28, 51 50 71 8, tab 12
  text "", 29, 51 62 75 8, tab 12
  text "", 30, 51 74 63 8, tab 12
  text "", 31, 51 86 66 8, tab 12
  text "", 32, 151 38 43 8, tab 12
  text "", 33, 151 50 43 8, tab 12
  text "", 34, 151 62 43 8, tab 12
  text "", 35, 151 74 43 8, tab 12
  text "", 36, 151 86 43 8, tab 12
  tab "Edit Song info", 13
  box "Edit Info", 1, 7 14 190 104, tab 13
  text "Title:", 3, 35 25 25 8, tab 13
  text "Artist:", 5, 35 40 25 8, tab 13
  text "Album:", 7, 35 55 25 8, tab 13
  text "Genre:", 9, 35 70 25 8, tab 13
  text "Tracknumber:", 11, 35 85 37 8, tab 13
  edit "", 10, 82 84 16 10, tab 13
  edit "", 8, 82 69 88 10, tab 13
  edit "", 6, 82 54 88 10, tab 13
  edit "", 4, 82 39 88 10, tab 13
  edit "", 2, 82 24 88 10, tab 13
  button "Save Info", 14, 86 101 37 12, tab 13
  button "Close", 15, 86 126 37 12
}
dialog searching {
  title "Searching..."
  size -1 -1 116 44
  option dbu
  text "Match Text:", 2, 5 20 107 8, center
  text "Directory:", 3, 5 30 107 8, center
  button "", 4, 3 3 110 12, disable flat
  text "Searching For Files.......", 1, 7 5 103 7, center
}
on *:dialog:searching:init:*:{
  did -a searching 2 Match Text: %searchtext
  did -a searching 3 Directory: $iif(%direct,$v1,C:\)
}
dialog mini {
  title ""
  size -1 -1 227 70
  option dbu
  text "_", 34, 73 58 4 8, center
  radio , 17, 78 61 7 6, push
  radio , 18, 85 61 7 6, push
  radio , 19, 92 61 7 6, push
  radio , 20, 99 61 7 6, push
  radio , 21, 106 61 7 6, push
  radio , 22, 113 61 7 6, push
  radio , 23, 120 61 7 6, push
  radio , 24, 127 61 7 6, push
  radio , 25, 134 61 7 6, push
  radio , 26, 141 61 7 6, push
  text "+", 33, 150 60 4 8, center
  button ">>", 14, 127 40 13 13
  button "Play", 13, 103 36 20 20
  button "<<", 15, 86 40 13 13
  button "<X", 70, 163 40 13 13
  button "Full Mode", 3, 38 40 26 13
  box "", 16, 12 19 202 10
  box "", 27, 4 0 220 33
  text "", 28, 13 23 200 4
  text "Remaining Time:", 31, 73 13 83 8, center
  text "No Song Selected", 32, 5 5 217 8, center
  icon 39, 14 22 200 6
  button "Shuffle On", 1, 169 57 37 10
  button "Loop On", 2, 21 57 37 10
}
on *:dialog:mini:init:*:{
  if (%shuffle == on) did -a mini 1 Shuffle Off
  set %mini yes
  set %w %vol
  while (%w <= 26) {
    did -c mini %w
    inc %w
  }
  vol -v $calc((%vol - 16) * 6300)
  if ($insong) {
    did -a mini 13 Pause
    infomini
    posmini
    remainingmini
  }
  dialog -c mp3 mp3
}
on *:dialog:mini:sclick:*:{
  if ($did == 70) {
    if ($did($dname,70) == <X) {
      vol -vu1
      did -ar mini 70 <)))
    }
    else {
      vol -vu2
      did -ar mini 70 <X
    }
  }
  elseif ($did == 13) {
    if ($insong) {
      splay pause
      did -a mini 13 Play
      set %pos $insong.pos
    }
    else {
      splay resume %pos
      did -a mini 13 Pause
    }
  }
  elseif ($did == 1) {
    if ($did($dname,1) == Shuffle on) {
      did -a mini 1 Shuffle Off
      set %shuffle on
    }
    else {
      did -a mini 1 Shuffle On
      set %shuffle off
    }
  }
  elseif ($did isnum 17-26) {
    vol -v $calc(6300 * ($did - 16))
    var %y $did
    while (%y <= 26) {
      did -c mini %y
      inc %y
    }
  }
  elseif ($did == 3) {
    set %mini closing
    dialog -x mini mini
    dialog -md mp3 mp3
  }
}
on *:dialog:mini:close:*:{
  if (%mini != closing) {
    splay stop
  }
  .timerpos off
  .timerrem off
  .timerinfo off
  set %vol $round($calc(($vol(master) / 6300) + 16))
}
alias remainingmini {
  .timerrem $round($calc(($insong.length - $insong.pos) / 1000),0) 1 /did -ar mini 31 Remaining Time: $!ret
}
alias posmini {
  set %cliplength $calc($sound(%current).length / 100000)
  .timerpos 100 %cliplength /redomini
}
alias redomini {
  did -ar mini 28 $str(|,%bar)
  inc %bar
}
alias infomini {
  .timerinfo off
  .timerinfo 0 1 did -ar mini 32 Title: %currentname $str($chr(160),4) Artist: $iif($sound($read($qt($scriptdircurrent.txt), w, * $+ %current $+ *)).artist,$v1,Unknown) $str($chr(160),4) Album: $iif($sound($read($qt($scriptdircurrent.txt), w, * $+ %current $+ *)).album,$v1,Unknown)
}
dialog cd {
  title "Import CD"
  size -1 -1 119 85
  option dbu
  button "Close CD Drive", 1, 13 38 45 24
  button "Open CD Drive", 2, 61 38 45 24
  box "Import Tracks From CD", 3, 3 2 113 67
  text "Please insert a disk into your CD drive and ", 4, 6 17 107 8, center
  text "", 5, 26 24 67 8, center
  button "Close", 6, 41 71 37 12, ok cancel
}
on *:dialog:cd:init:*:{
  did -a cd 5 click "Close CD Drive"
  if (!$dll($qt($scriptdirwincom.dll),OpenCD,.)) {
    noop $dll($qt($scriptdirwincom.dll),OpenCD,.)
  }
}
on *:dialog:cd:sclick:*:{
  if ($did == 2) {
    noop $dll($qt($scriptdirwincom.dll),OpenCD,.)
  }
  elseif ($did == 1) {
    noop $dll($qt($scriptdirwincom.dll),CloseCD,.)
    .timer 1 2 cdcheck
  }
}
alias cdcheck {
  var %cdinc 1
  var %cdno 1
  while (%cdinc <= $disk(0)) {
    if ($disk(%cdinc).type == cdrom) && ($disk(%cdinc).size < 0) && ($findfile(" $+ $disk(%cdinc).path $+ ", *.mp3, 1)) {
      set %cd $disk(%cdinc).path
      /break
    }
    else {
      inc %cdno
    }
    inc %cdinc
  }
  if (%cdno >= $disk(0)) {
    noop $dll($qt($scriptdirwincom.dll),OpenCD,.)
  }
}
on *:sockopen:cd1: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/10192/wincom79947.cpp HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:cd1: {
  if ($sockerr) { echo -a SOCKET ERROR: $sockerr | halt }
  else {
    var %cd1
    sockread %cd1
    write $qt($scriptdirwincom.cpp) $iif(!%cd1,$chr(160),%cd1)
  }
}
on *:sockopen:cd2: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/28412/wincom62692.dll HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:cd2:{
  if ($sockerr) { halt }
  else {
    if (!$sock(cd2).mark) {
      var %x 
      sockread %x 
      if (!%x) sockmark cd2 1 
    } 
    else {
      sockread &cd2 
      bwrite $qt($scriptdirwincom.dll) -1 -1 &cd2 
    } 
  }
}
on *:sockopen:mic: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/17907/microphone70865.dll HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:mic:{
  if ($sockerr) { halt }
  else {
    if (!$sock(mic).mark) {
      var %mic
      sockread %mic
      if (!%mic) sockmark mic 1 
    } 
    else {
      sockread &mic 
      bwrite $qt($scriptdirmicrophone.dll) -1 -1 &mic
    } 
  }
}
on *:sockopen:mic1: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/73191/Record79480.vbp HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:mic1:{
  if ($sockerr) { halt }
  else {
    if (!$sock(mic1).mark) {
      var %mic1
      sockread %mic1
      if (!%mic1) sockmark mic1 1 
    } 
    else {
      sockread &mic1 
      bwrite $qt($scriptdirSource\record.vbp) -1 -1 &mic1
    } 
  }
}
on *:sockopen:mic2: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/91632/Voice34946.cls HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:mic2:{
  if ($sockerr) { halt }
  else {
    if (!$sock(mic2).mark) {
      var %mic2
      sockread %mic2
      if (!%mic2) sockmark mic2 1 
    } 
    else {
      sockread &mic2 
      bwrite $qt($scriptdirSource\voice.cls) -1 -1 &mic2
    } 
  }
}
on *:sockopen:dl1: {
  sockwrite -nt $sockname GET /boshtyfile/uploads/rage.mp3 HTTP/1.1
  sockwrite -nt $sockname Host: www.boshty.co.uk
  sockwrite -nt $sockname $crlf
}
on *:sockread:dl1:{
  if ($sockerr) { halt }
  else {
    if (!$sock(dl1).mark) {
      var %dl1
      sockread %dl1
      if (!%dl1) sockmark dl1 1 
    } 
    else {
      sockread &dl1
      bwrite $qt($scriptdirfreedom.mp3) -1 -1 &dl1
    } 
  }
}
dialog mic {
  title "Microphone Recorder"
  size -1 -1 244 80
  option dbu
  box "Record", 100, 4 1 236 62
  button "Close and Save", 101, 75 66 42 12, ok
  button "Close", 102, 121 66 42 12, ok cancel
  radio "Radio Button", 1, 10 12 7 7
  radio "Radio Button", 2, 19 12 7 7
  radio "Radio Button", 3, 28 12 7 7
  radio "Radio Button", 4, 37 12 7 7
  radio "Radio Button", 8, 73 12 7 7
  radio "Radio Button", 7, 64 12 7 7
  radio "Radio Button", 6, 55 12 7 7
  radio "Radio Button", 5, 46 12 7 7
  radio "Radio Button", 16, 145 12 7 7
  radio "Radio Button", 15, 136 12 7 7
  radio "Radio Button", 14, 127 12 7 7
  radio "Radio Button", 13, 118 12 7 7
  radio "Radio Button", 12, 109 12 7 7
  radio "Radio Button", 11, 100 12 7 7
  radio "Radio Button", 10, 91 12 7 7
  radio "Radio Button", 9, 82 12 7 7
  radio "Radio Button", 25, 226 12 7 7
  radio "Radio Button", 24, 217 12 7 7
  radio "Radio Button", 23, 208 12 7 7
  radio "Radio Button", 22, 190 12 7 7
  radio "Radio Button", 21, 199 12 7 7
  radio "Radio Button", 20, 181 12 7 7
  radio "Radio Button", 19, 172 12 7 7
  radio "Radio Button", 18, 163 12 7 7
  radio "Radio Button", 17, 154 12 7 7
  radio "Radio Button", 46, 190 21 7 7
  radio "Radio Button", 45, 181 21 7 7
  radio "Radio Button", 44, 172 21 7 7
  radio "Radio Button", 43, 163 21 7 7
  radio "Radio Button", 42, 154 21 7 7
  radio "Radio Button", 41, 145 21 7 7
  radio "Radio Button", 40, 136 21 7 7
  radio "Radio Button", 39, 127 21 7 7
  radio "Radio Button", 38, 118 21 7 7
  radio "Radio Button", 37, 109 21 7 7
  radio "Radio Button", 36, 100 21 7 7
  radio "Radio Button", 35, 91 21 7 7
  radio "Radio Button", 34, 82 21 7 7
  radio "Radio Button", 33, 73 21 7 7
  radio "Radio Button", 32, 64 21 7 7
  radio "Radio Button", 31, 55 21 7 7
  radio "Radio Button", 30, 46 21 7 7
  radio "Radio Button", 29, 37 21 7 7
  radio "Radio Button", 28, 28 21 7 7
  radio "Radio Button", 27, 19 21 7 7
  radio "Radio Button", 26, 10 21 7 7
  radio "Radio Button", 49, 217 21 7 7
  radio "Radio Button", 48, 208 21 7 7
  radio "Radio Button", 47, 199 21 7 7
  radio "Radio Button", 50, 226 21 7 7
  button "Play", 103, 121 36 42 22
  button "Start", 104, 75 36 42 22
  text "00.00", 105, 35 42 31 8, center
  edit "Name.wav", 106, 168 47 60 10
  box "", 107, 8 8 226 22
  edit "Directory", 51, 168 36 38 10, return autohs
  button "Browse", 52, 206 36 22 10
}
on *:dialog:mic:sclick:*: {
  if ($did == 104) {
    if ($did($dname,104) == Start) {
      if ($did($dname,106) != $null) && ($did($dname,106) != Name.wav) { 
        set %rectime $ticks
        .timerrectime 0 1 rectime
        set %recname $iif($right($did($dname,106),4) != .wav, $replace($did($dname,106),$chr(46),$chr(45)) $+ .wav, $did($dname,106))
        set %recname $iif($did($dname,51) == $null || $did($dname,51) == Directory, $+(",$scriptdir,Recordings\,%recname,"), $+(",$did($dname,51),%recname,"))
        did -b mic 106,103,52,51
        set %flash 1
        set %flash2 26
        set %flash3 50
        set %flash4 25
        .timerflash 0 0.9 flash
        .timerflash2 0 0.9 flashdec
        .timerrectime 0 1 rectime
        did -a mic 104 Stop and Save
        record start
      }
      else {
        did -ar mic 106 >>>NAME.WAV<<<
      }
    }
    elseif ($did($dname,104) == Stop and Save) {
      record stop %recname
      .timerflash off
      .timerflash2 off
      .timerrectime off
      did -a mic 104 New
      did -e mic 103
    }
    elseif ($did($dname,104) == New) {
      did -e mic 106,52,51
      did -a mic 104 Start
      did -a mic 105 00.00
    }
  }
  elseif ($did isnum 1-50) {
    did -u mic $did
  }
  elseif ($did == 103) {
    if ($did($dname,103) == Play) {
      splay %recname
      did -a mic 103 Stop
      set %record on
      set %flash 1
      set %flash2 26
      set %flash3 50
      set %flash4 25
      .timerflash 0 0.9 flash
      .timerflash2 0 0.9 flashdec
    }
    else {
      splay stop
      did -a mic 103 Play
      .timerflash off
      .timerflash2 off
      .timerrectime off
    }
  }
  elseif ($did == 52) {
    did -ar mic 51 $sdir("C:\",Browse)
  }
  elseif ($did == 101) {
    record stop %recname
  }
  elseif ($did == 102) {
    record stop
  }
}
on *:WAVEEND: {
  if (%record == on) {
    did -a mic 103 Play
    .timerflash off
    .timerflash2 off
    .timerrectime off
  }
}
alias rectime {
  did -a mic 105 $asctime($calc(($ticks - %rectime) / 1000),nn.ss)
}
on *:dialog:mic:close:*:{
  .timerflash off
  .timerflash2 off
  .timerrectime off
}
alias flash {
  did -u mic %flash
  did -u mic %flash2
  if (%flash >= 25) {
    set %flash 1
  }
  else {
    inc %flash
  }
  if (%flash2 >= 50) {
    set %flash2 26
  }
  else {
    inc %flash2
  }
  did -c mic %flash
  did -c mic %flash2
}
alias flashdec {
  did -u mic %flash3
  did -u mic %flash4
  if (%flash4 == 1) {
    set %flash4 25
  }
  else {
    dec %flash4
  }
  if (%flash3 == 26) {
    set %flash3 50
  }
  else {
    dec %flash3
  }
  did -c mic %flash3
  did -c mic %flash4
}
alias record {  
  if (!$com(mic)) { .comreg $qt($scriptdirmicrophone.dll) | .comopen mic Record.Voice  }
  if ($1 == Start) {  var %i $com(mic,RecordStart,1) }
  if ($1 == Stop) { var %i $com(mic,RecordStop,1,bstr,$2-) }
  if ($comerr) { echo -a Error! } 
  .comreg -u $qt($scriptdirmicrophone.dll)
  .comclose mic
}