All pastes #637957 Raw Edit

Stuff

public text v1 · immutable
#637957 ·published 2007-07-29 12:15 UTC
rendered paste body
menu * { 
  -
  Media Player:/dialog -iem med med
  -
}
on *:MP3END: { 
  if ($did(med,4).sel == $did(med,4).lines) { 
    set %line 2
    /splay  $did(med,2).seltext $+ \ $+ $did(med,4,2).text 
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
    did -c med 4 %line
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
  }
  elseif ($did(med,4).sel != $did(med,4).lines) { 
    inc %line
    /splay $did(med,2).seltext $+ \ $+ $did(med,4,%line).text
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
    did -c med 4 %line
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
  }
}
dialog med { 
  title "Media Player"
  size -1 -1 600 280

  text "Directory's:", 1, 1 1 80 20
  list 2, 1 20 200 230, ok

  text "Song's:", 3, 210 1 80 20
  list 4, 210 20 200 230, auto hs

  box "Options", 5, 420 1 125 40
  button ">", 6, 430 15 25 25
  button "", 7, 455 15 25 25
  button "|<<", 8, 480 15 25 25
  button ">>|", 9, 505 15 25 25

  box "Volume", 10, 420 50 80 115
  button "Up", 11, 430 65 60 25
  button "Down", 12, 430 90 60 25
  button "Mute", 13, 430 115 60 25
  text "", 14, 450 140 40 20

  button "Add Directory", 15, 510 50 89 20
  button "Use Directory", 16, 510 70 89 20
  button "Find Files", 17, 510 90 89 20
  button "Close", 18, 510 110 89 20, ok
  box "Directory", 19, 420 170 179 40
  edit "", 20, 426 185 170 20, autohs, auto hs

  text "Song:", 21, 1 255 50 20
  text "", 22, 30 255 150 20

  text "Album:", 23, 190 255 50 20
  text "", 24, 225 255 150 20

  text "Artist:", 25, 385 255 50 20
  text "", 26, 415 255 150 20
  button "Random", 27, 510 130 89 20
}
on *:dialog:med:sclick:27: { 
  set %line $rand(2,$did(4).lines)
  if (%line == $did(4).sel)   set %line $rand(1,$did(4).lines)
  /splay $did(2).seltext $+ \ $+ $did(4,%line).text
  did -a med 22 $sound($insong.fname).title
  did -a med 24 $sound($insong.fname).album
  did -a med 26 $sound($insong.fname).artist
  did -c med 4 %line
  did -a med 6 ||
  set %line $did(4).sel
  dialog -t med Media Player: $sound($insong.fname).artist
}
on *:dialog:med:init:*: { 
  did -a med 14 %vollvl $+ $chr(37)
  if (%total == $null) halt
  unset %halt
  set %directs 1 
  .timerdirects 0 0.5 directs
}
on *:dialog:med:close:*: { 
  /splay stop
}
on *:dialog:med:sclick:13: { 
  if (%mute == on) { 
    /vol -v %oldvol
    did -a med 14 %oldlvl 
    unset %oldlvl
    unset %oldvol
    unset %mute
  }
  else { 
    set %oldvol $vol(master)
    set %oldlvl $did(14)
    /vol -v 0
    did -a med 14 0 $+ $chr(37)
    set %mute on
  }
}
on *:DIALOG:med:sclick:11:{ 
  var %a = $calc( $remove($did(med,14),$chr(37)) + 5 ) 
  if (%a > 100) { halt } 
  did -ra med 14 %a $+ $chr(37) 
  set %vollvl %a
  vol -v $calc( %a / 100 * 65535 )
  unset %mute 
} 
on *:DIALOG:med:sclick:12:{ 
  var %a = $calc( $remove($did(med,14),$chr(37)) - 5 ) 
  if (%a < 0) { halt } 
  did -ra med 14 %a $+ $chr(37) 
  set %vollvl %a
  vol -v $calc( %a / 100 * 65535 ) 
  unset %mute
}
on *:dialog:med:sclick:7: { 
  /splay stop
  did -a med 6 >
}
on *:dialog:med:sclick:8,9: { 
  if ($did == 9) { 
    if ($calc($did(4).sel + 1) > $did(4).lines) { 
      halt 
    }
    else {
      set %x $calc($did(4).sel + 1)
      /splay $did(20) $+ \ $+ $did(4,%x).text
      set %line $did(4).sel
      dialog -t med Media Player: $sound($insong.fname).artist
      did -c med 4 %x
      did -a med 22 $sound($insong.fname).title
      did -a med 24 $sound($insong.fname).album
      did -a med 26 $sound($insong.fname).artist

    }
  }
  else {
    if ($calc($did(4).sel - 1) < 0) { 
      halt 
    }
    else {
      set %x $calc($did(4).sel - 1)
      /splay $did(20) $+ \ $+ $did(4,%x).text
      did -c med 4 %x
      set %line $did(4).sel
      dialog -t med Media Player: $sound($insong.fname).artist
      did -a med 22 $sound($insong.fname).title
      did -a med 24 $sound($insong.fname).album
      did -a med 26 $sound($insong.fname).artist
    }
  }
}
on *:dialog:med:dclick:4: {
  if ($insong.fname != $did(20) $+ \ $+ $did(4).seltext) { 
    did -a med 6 ||
    /splay $did(20) $+ \ $+ $did(4).seltext
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
  }   
  elseif (%play == on) {
    unset %play 
    /splay pause
    did -a med 6 >
    set %pause on
  }
  elseif (%pause == on) { 
    /splay resume
    unset %pause 
    did -a med 6 ||
    set %play on
  }
  else {
    set %play on
    /splay $did(20) $+ \ $+ $did(4).seltext
    /did -a med 6 ||
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
  }
}
on *:dialog:med:sclick:6: { 
  if ($insong.fname != $did(20) $+ \ $+ $did(4).seltext) { 
    /splay $did(20) $+ \ $+ $did(4).seltext
    did -a med 6 ||
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
  }  
  elseif (%play == on) {
    unset %play 
    /splay pause
    did -a med 6 >
    set %pause on
  }
  elseif (%pause == on) { 
    /splay resume
    unset %pause 
    did -a med 6 ||
    set %play on
  }
  else {
    set %play on
    /splay $did(20) $+ \ $+ $did(4).seltext
    /did -a med 6 ||
    set %line $did(4).sel
    dialog -t med Media Player: $sound($insong.fname).artist
    did -a med 22 $sound($insong.fname).title
    did -a med 24 $sound($insong.fname).album
    did -a med 26 $sound($insong.fname).artist
  }
}
on *:dialog:med:sclick:15: { 
  /dialog -m medf medf 
}
on *:dialog:med:sclick:16,17: { 
  did -ra med 20 $did(2).seltext
  did -ra med 4
  $findfile($did(2).seltext,*.mp3,0,did -a med 4 $nopath($1-)) 
  $findfile($did(2).seltext,*.wma,0,did -a med 4 $nopath($1-))
}
on *:dialog:med:dclick:2: { 
  did -ra med 20 $did(2).seltext
  did -ra med 4
  $findfile($did(2).seltext,*.mp3,0,did -a med 4 $nopath($1-)) 
  $findfile($did(2).seltext,*.wma,0,did -a med 4 $nopath($1-))
}
alias -l directs {
  if ($dialog(med)) && (%halt == $null) {  
    if (%directs > %total) { unset %directs | set %halt on } 
    else { 
      did -a med 2 %dir. [ $+ [ %directs ] ] 
      inc %directs
    }
  } 
}
dialog medf { 
  title "Media Player - File Directory:"
  size -1 -1 800 50

  edit "", 1, 1 1 798 20
  button "Done", 2, 1 21 798 29, ok
}
on *:dialog:medf:edit:1: { 
  dialog -t medf Media Player - File Directory: $did(1)
}
on *:dialog:medf:sclick:2: { 
  inc %total
  set %dir. [ $+ [ %total ] ] $did(1)
  did -a med 2 $did(1)
}
alias msnsong { 
  var %dll $mircdir/MsnSong.dll 
  .comreg %dll 
  .comopen msn Msn.Write 
  var %i $com(msn,WriteToMsn,1,bstr,$1-,bstr,$null,bstr,$null) 
  .comreg -u %dll 
  .comclose msn 
}