mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2013
Posts: 19
K
KeiroD Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Mar 2013
Posts: 19
So I decided to try my hand at writing the media player code. It uses the nHTML dll... though I'm wondering if I should switch to DCX for this? I mean... I can probably switch to DCX and get a better result... but I'm still learning DCX.

Code:
dialog mmp.dialog {
  title "Video Player"
  icon "C:\Program Files\Windows Media Player\wmplayer.exe"
  size -1 -1 295 235
  box "play", 1, -12 -17 335 269
  menu "File", 2
  item "Open...", 4, 2
  item "Open URL...", 5, 2
  item break, 6, 2
  item "Exit", 7, 2, ok
  menu "View", 8
  item "Playlist", 9, 8
  button "", 10, 0 0 0 0
}
on *:LOAD:{ set %mmp.playdir C:\ }
on *:UNLOAD:{ unset %mmp.* }
on *:DIALOG:mmp.dialog:close:*:{
  if ($dialog(playlist) != $null) {
    dialog -x playlist
  }
}
on *:dialog:mmp.dialog:*:*:{ 
  if ($devent == init) { 
    dll $mmp.dll(mdx) SetMircVersion $version | 
    dll $mmp.dll(mdx) MarkDialog $dname | 
    dll $mmp.dll(mdx) SetControlMDX $dname 10 Positioner size minbox maxbox > $mmp.dll(dialog) 
  } 
  if ($devent == menu) { 
    if ($did == 4) { 
      mmp.open 
    } 
    if ($did == 5) { 
      mmp.openurl 
    } 
    if ($did == 9) {
      vidlist
    }
  }
  if ($devent == sclick) { 
    dll $mmp.dll(mdx) MoveControl $dname 1 * * $calc($dialog($dname).cw + 40) $calc($dialog($dname).ch + 34) 
  } 
}
alias mmp.open { write -c " $+ $scriptdirmmp.html $+ " 
  if (!$isdir(%mmp.playdir)) { 
    set %mmp.playdir C:\ 
  } 
  set %mmp.media $sfile( $+ %mmp.playdir $+ ,Select A Media File To Play,Play) 
  if (%mmp.media) { 
    write " $+ $scriptdirmmp.html $+ " <embed width="100%" height="100%" src=" $+ %mmp.media $+ "> 
    write addons\vidlist.txt %mmp.media
    if ($dialog(playlist)) { loadbuf -ro playlist 1 addons\vidlist.txt }
    dll $mmp.dll(html) attach $dll($mmp.dll(html),find,play) 
    dll $mmp.dll(html) navigate $scriptdirmmp.html 
    set %mmp.playdir $nofile(%mmp.media) 
    dialog -t mmp.dialog $nopath(%mmp.media) - mIRC Media Player 
  } 
}
alias mmp.openurl { 
  write -c " $+ $scriptdirmmp.html $+ " 
  set %mmp.mediaurl $$?"URL To Media File:" 
  if (%mmp.mediaurl) { 
    write " $+ $scriptdirmmp.html $+ " <embed width="100%" height="100%" src=" $+ %mmp.mediaurl $+ "> 
    dll $mmp.dll(html) attach $dll($mmp.dll(html),find,play) 
    dll $mmp.dll(html) navigate $scriptdirmmp.html 
    dialog -t mmp.dialog $nopath(%mmp.mediaurl) - mIRC Media Player 
  } 
}
alias mmp.dll { 
  if ($$1 == mdx) { 
    return " $+ $scriptdirmdx.dll $+ " 
  }  
  if ($$1 == dialog) { 
    return $scriptdirDialog.mdx 
  } 
  if ($$1 == html) { 
    return " $+ $scriptdirnHTMLn_2.95.dll $+ " 
  } 
}
alias mmp { dialog -m $+ $1 mmp.dialog mmp.dialog }
menu status,menubar {
  -
  Video Player
  .$iif($dialog(mmp.dialog),$style(2)) Open on desktop:{ mmp d }
  .$iif($dialog(mmp.dialog),$style(2)) Open inside mIRC:{ mmp }
}
dialog playlist {
  title "Playlist"
  size -1 -1 195 180
  option dbu
  list 1, 2 9 190 153, size vsbar hsbar
  button "Add", 2, 29 164 37 12
  button "Remove", 3, 75 164 37 12
  button "Clear", 4, 121 164 37 12
}
alias vidlist {
  if ($dialog(playlist) != $null) { dialog -v playlist | halt }
  else { dialog -m playlist playlist }
}
on *:DIALOG:playlist:init:*:{
  loadbuf -ro playlist 1 addons\vidlist.txt
  did -z playlist 1 1 3
}
on *:DIALOG:playlist:dclick:*:{
  if ($did == 1) {
    write -c " $+ $scriptdirmmp.html $+ " 
    set %mmp.media $did(playlist,1).seltext
    if (%mmp.media) { 
      write " $+ $scriptdirmmp.html $+ " <embed width="100%" height="100%" src=" $+ %mmp.media $+ "> 
      dll $mmp.dll(html) attach $dll($mmp.dll(html),find,play) 
      dll $mmp.dll(html) navigate $scriptdirmmp.html 
      set %mmp.playdir $nofile(%mmp.media) 
      dialog -t mmp.dialog $nopath(%mmp.media) - mIRC Media Player 
    } 
    dialog -v mmp.dialog
  }
}
on *:DIALOG:playlist:sclick:*:{
  if ($did == 2) {
    set %add.files $$msfile( $+ %mmp.playdir $+ ,Select Media File(s) To Add,Add) 
    var %i = 1
    while (%i <= %add.files) {
      write addons\vidlist.txt $msfile(%i) 
      inc %i
    }
    loadbuf -ro playlist 1 addons\vidlist.txt
    did -z playlist 1 1 3
  }
  if ($did == 3) {
    set %vid.del $did(playlist,1).sel
    write -dl $+ %vid.del addons\vidlist.txt
    loadbuf -ro playlist 1 addons\vidlist.txt
  }
  if ($did == 4) {
    write -c addons\vidlist.txt
    loadbuf -ro playlist 1 addons\vidlist.txt
  }
}

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Which part locks up mIRC?

Joined: Mar 2013
Posts: 19
K
KeiroD Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Mar 2013
Posts: 19
Originally Posted By: hixxy
Which part locks up mIRC?


I'm not sure. It is able to play sounds just fine. But when I go to mouse it over, I see that the music player has basically locked mIRC up, disallowing any attempts to stop the music player.

This then forces you to close the entire mIRC in order to escape the music player in question.

Something IS causing it to lock up... is it because I moved to nHTML2.95 instead of sticking with nHTML 2.92?

This is on Windows 7, x64, by the way.

Joined: Sep 2005
Posts: 2,881
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,881
Originally Posted By: KeiroD
Originally Posted By: hixxy
Which part locks up mIRC?


I'm not sure. It is able to play sounds just fine. But when I go to mouse it over, I see that the music player has basically locked mIRC up, disallowing any attempts to stop the music player.

This then forces you to close the entire mIRC in order to escape the music player in question.

Something IS causing it to lock up... is it because I moved to nHTML2.95 instead of sticking with nHTML 2.92?

This is on Windows 7, x64, by the way.


It might be that DLL. Did this script work fine with 2.92? I know that nHTMLn was written when XP was still the latest version of Windows and hasn't been updated for a number of years, so maybe it just doesn't work very well with Win7?

Joined: Jun 2003
Posts: 81
T
TRT Offline
Babel fish
Offline
Babel fish
T
Joined: Jun 2003
Posts: 81
I find it funny that nHTMLn still works considering all the things Microsoft abandoned over the years. Or maybe they just forgot the component like the rest of ActiveX. wink

Why don't you just use the DCX directshow control? That way you also get rid of the IE and WMP dependencies.

Last edited by TRT; 22/03/13 10:29 PM.
Joined: Mar 2013
Posts: 19
K
KeiroD Offline OP
Pikka bird
OP Offline
Pikka bird
K
Joined: Mar 2013
Posts: 19
Originally Posted By: TRT
I find it funny that nHTMLn still works considering all the things Microsoft abandoned over the years. Or maybe they just forgot the component like the rest of ActiveX. wink

Why don't you just use the DCX directshow control? That way you also get rid of the IE and WMP dependencies.


Not familiar with DCX.

I'd switch to DCX, if I knew there was a script that handles this rather nicely. smirk


Link Copied to Clipboard