mIRC Home    About    Download    Register    News    Help

Print Thread
Joined: Mar 2004
Posts: 150
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 150
I've created a new dialog for my personal script for mp3 playing and decided i'd also like to have a radio player in it also. The problem i ran accross is that most online radio streams use realplayer or windows media player. This would work fine if i didn't have one of them opening when the radio station is selected from the dropdown within the dialog. Is there a way to make/get realplayer and/or windows media player to load but in the background so it's never seen loading or even being used for that matter. Things such as radio stations loading (being able to see the program open) windows or other programs installed to play them is kinda pointless in my opinion.

dialog radio {
title "Radio"
size -1 -1 104 18
option dbu
combo 1, 2 5 60 50, size drop
button "Go", 2, 65 5 37 10
box "radio", 3, 65 13 36 21, hide
}

on *:dialog:radio:init:*:{
did -a radio 1 KNAC
did -c radio 1 1
var %hwnd = $dll($mircdirsystem/dlls/nHTMLn.dll,find,radio)
var %v = $dll($mircdirsystem/dlls/nHTMLn.dll,attach,%hwnd)
var %h = $dll($mircdirsystem/dlls/nHTMLn.dll,navigate,http://www.geocities.com/darqmnm/images/Outlawz_Avitar.jpg)
}

on *:dialog:radio:sclick:2:{
if ($did(1) == KNAC) { var %v = $dll($mircdirsystem/dlls/nHTMLn.dll,attach,%hwnd) | var %h = $dll($mircdirsystem/dlls/nHTMLn.dll,navigate,http://release.theplatform.com/content.select?pid=BCT5C2ep_WzY-FwhX9oOc1SZUaiInt_M&UserName=knaclive)http://release.theplatform.com/content.select?pid=BCT5C2ep_WzY-FwhX9oOc1SZUaiInt_M&UserName=knaclive) | echo -a Now Playing KNAC }

NOTE: This is just the Radio Part Of the Dialog, everything else working fine

Any help/ideas with this is greatly appreciated. I just have no clue how to get the program to load and run without me actually seeing it load and run.

Joined: Dec 2002
Posts: 1,893
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,893
Using COM you can run the player invisibly and control it.

The commands /runWMP and /runRP launch Windows Media Player and RealPlayer respectively, and /closePlayers closes both programs (you'll probably want to call it when the user closes the dialog or switches to the MP3 player mode)


alias runWMP {
  • ;
    ; Usage: /runWMP <url>
    ;

    if !$1 {
    echo -aec info * /runWMP: insufficient parameters.
    return
    }
    if !$com(objWMP) {
    if $com(objRP) { closeRP }
    .comopen objWMP WMPlayer.OCX.7
    if $comerr {
    echo -aec info * /runWMP: incompatible Windows Media Player version.
    return
    }
    !.echo -q $com(objWMP,Settings,2,dispatch*objSettings)
    !.echo -q $com(objSettings,autoStart,4,bool,true)
    .comclose objSettings
    }
    !.echo -q $com(objWMP,URL,4,bstr,$1-)
}

alias runRP {
  • ;
    ; Usage: /runRP <url>
    ;

    if !$1 {
    echo -aec info * /runRP: insufficient parameters.
    return
    }
    if !$com(objRP) {
    if $com(objWMP) { closeWMP }
    .comopen objRP rmocx.RealPlayer G2 Control.1
    if $comerr {
    echo -aec info * /runRP: incompatible RealPlayer version.
    return
    }
    }
    else !.echo -q $com(objRP,DoStop,1)
    !.echo -q $com(objRP,Source,4,bstr,$1-)
    !.echo -q $com(objRP,DoPlay,1)
}

alias -l closeWMP {
  • !.echo -q $com(objWMP,Close,1)
    .comclose objWMP
}

alias -l closeRP .comclose objRP

alias closePlayers {
  • ;
    ; Usage: /closePlayers
    ;

    if $com(objWMP) { closeWMP }
    if $com(objRP) { closeRP }
}


Note: RealPlayer requires that local files will be passed in this format: file:[/i]//C:\PATH\SONG.RM

Helpful links:

Joined: Mar 2004
Posts: 150
D
Darkmnm Offline OP
Vogon poet
OP Offline
Vogon poet
D
Joined: Mar 2004
Posts: 150
Thanks for the coding, it works great !!


Link Copied to Clipboard