Discussion:
Opening Win Media Player from a CHM file ?
(too old to reply)
Boopipi
2010-03-29 19:23:40 UTC
Permalink
Hello everyone,

I've made a help file with "HTML Help Workshop 4.74"

What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a fixed
file location.

This will never be viewed in a web browser, it will always be a CHM file.

Someone from this group gave me a link, but that link was on embedding the
player inside the CHM file. This I don't want.

Thanks for your time and for any info you can provide.
Rob Chandler [MVP]
2010-03-30 09:49:39 UTC
Permalink
So you need to write some script that finds the
location of the Video file. Usually the Video
file is near the CHM so you just find the CHM
path, and add the video filename.

http://helpware.net/FAR/far_faq.htm#Applets
(scroll down a bit to the GetChmDir() function)

Rob
Post by Boopipi
Hello everyone,
I've made a help file with "HTML Help Workshop 4.74"
What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a fixed
file location.
This will never be viewed in a web browser, it will always be a CHM file.
Someone from this group gave me a link, but that link was on embedding the
player inside the CHM file. This I don't want.
Thanks for your time and for any info you can provide.
Boopipi
2010-03-30 17:08:31 UTC
Permalink
Hello,

Thanks for your response,

Actually the MP3 will always be in the same directory as the CHM (don't need
to obtain the path). I just need to call up Windows Media Player (not
within the CHM but in its regular window) and have it play the MP3
automatically.

The "getchmdir()" that you pointed out seems to search for and return the
path.

I tried putting the following directly in the HTML. It didn't work:

<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="teaching.mp3">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT>

================================
Post by Rob Chandler [MVP]
So you need to write some script that finds the
location of the Video file. Usually the Video
file is near the CHM so you just find the CHM
path, and add the video filename.
http://helpware.net/FAR/far_faq.htm#Applets
(scroll down a bit to the GetChmDir() function)
Rob
Post by Boopipi
Hello everyone,
I've made a help file with "HTML Help Workshop 4.74"
What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a
fixed file location.
This will never be viewed in a web browser, it will always be a CHM file.
Someone from this group gave me a link, but that link was on embedding
the player inside the CHM file. This I don't want.
Thanks for your time and for any info you can provide.
Rob Chandler [MVP]
2010-03-31 07:48:20 UTC
Permalink
No I understand. Your script needs to get the CHM dir using
that GetChmDir() call then you need to dynamically create
that media player code using the path.

Off the top of my head you need to try something like this...

var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path); //debug
document.writeln('<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">');
document.writeln('<PARAM NAME="fileName" VALUE="'+path+'teaching.mp3">');
document.writeln('<PARAM NAME="autoStart" VALUE="true">');
document.writeln('<PARAM NAME="showControls" VALUE="true">');
document.writeln('</OBJECT>');

I often run external media but I let mine open in the desktop player...

var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path);
document.writeln('<a href="'+path+'teaching.mp3">Click me</a>');

Rob
Post by Boopipi
Hello,
Thanks for your response,
Actually the MP3 will always be in the same directory as the CHM (don't
need to obtain the path). I just need to call up Windows Media Player
(not within the CHM but in its regular window) and have it play the MP3
automatically.
The "getchmdir()" that you pointed out seems to search for and return the
path.
<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="teaching.mp3">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT>
================================
Post by Rob Chandler [MVP]
So you need to write some script that finds the
location of the Video file. Usually the Video
file is near the CHM so you just find the CHM
path, and add the video filename.
http://helpware.net/FAR/far_faq.htm#Applets
(scroll down a bit to the GetChmDir() function)
Rob
Post by Boopipi
Hello everyone,
I've made a help file with "HTML Help Workshop 4.74"
What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a
fixed file location.
This will never be viewed in a web browser, it will always be a CHM file.
Someone from this group gave me a link, but that link was on embedding
the player inside the CHM file. This I don't want.
Thanks for your time and for any info you can provide.
Boopipi
2010-04-02 01:11:57 UTC
Permalink
As you probably surmised, my Javascript is limited.

Why do you need to have GetChmDir() get the path ? Couldn't one just insert
a path when you dynamically create the media player ? The location of the
CHM and the MP3s are fixed; these paths will not change.

The CHM will have roughly 20 pages. Each page describes an MP3 file of a
sunday service, and gives the user the option of hearing the MP3 in a
separate media player window.

By the way, will this work in XP, 98, Vista ?

Thanks for your help. Much appreciated.

Peter

===================================
Post by Rob Chandler [MVP]
No I understand. Your script needs to get the CHM dir using
that GetChmDir() call then you need to dynamically create
that media player code using the path.
Off the top of my head you need to try something like this...
var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path); //debug
document.writeln('<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">');
document.writeln('<PARAM NAME="fileName" VALUE="'+path+'teaching.mp3">');
document.writeln('<PARAM NAME="autoStart" VALUE="true">');
document.writeln('<PARAM NAME="showControls" VALUE="true">');
document.writeln('</OBJECT>');
I often run external media but I let mine open in the desktop player...
var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path);
document.writeln('<a href="'+path+'teaching.mp3">Click me</a>');
Rob
Post by Boopipi
Hello,
Thanks for your response,
Actually the MP3 will always be in the same directory as the CHM (don't
need to obtain the path). I just need to call up Windows Media Player
(not within the CHM but in its regular window) and have it play the MP3
automatically.
The "getchmdir()" that you pointed out seems to search for and return the
path.
<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="teaching.mp3">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT>
================================
Post by Rob Chandler [MVP]
So you need to write some script that finds the
location of the Video file. Usually the Video
file is near the CHM so you just find the CHM
path, and add the video filename.
http://helpware.net/FAR/far_faq.htm#Applets
(scroll down a bit to the GetChmDir() function)
Rob
Post by Boopipi
Hello everyone,
I've made a help file with "HTML Help Workshop 4.74"
What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a
fixed file location.
This will never be viewed in a web browser, it will always be a CHM file.
Someone from this group gave me a link, but that link was on embedding
the player inside the CHM file. This I don't want.
Thanks for your time and for any info you can provide.
Rob Chandler [MVP]
2010-04-02 15:54:19 UTC
Permalink
Hi Peter

The only reliable way we have found is to dynamically
create an absolute path and code at run time.
If you find a better way let us know :-)

XP and Vista good. Win98 (IE4 and HH 1.1)
is very old. If you have problems you may need
to ask users to upgrade to Win98 SE (IE5 and HH 1.21)
or maybe just install a later version of IE which should
also include a later version of HH runtime.

Rob
Post by Boopipi
As you probably surmised, my Javascript is limited.
Why do you need to have GetChmDir() get the path ? Couldn't one just
insert a path when you dynamically create the media player ? The location
of the CHM and the MP3s are fixed; these paths will not change.
The CHM will have roughly 20 pages. Each page describes an MP3 file of a
sunday service, and gives the user the option of hearing the MP3 in a
separate media player window.
By the way, will this work in XP, 98, Vista ?
Thanks for your help. Much appreciated.
Peter
===================================
Post by Rob Chandler [MVP]
No I understand. Your script needs to get the CHM dir using
that GetChmDir() call then you need to dynamically create
that media player code using the path.
Off the top of my head you need to try something like this...
var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path); //debug
document.writeln('<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">');
document.writeln('<PARAM NAME="fileName" VALUE="'+path+'teaching.mp3">');
document.writeln('<PARAM NAME="autoStart" VALUE="true">');
document.writeln('<PARAM NAME="showControls" VALUE="true">');
document.writeln('</OBJECT>');
I often run external media but I let mine open in the desktop player...
var path = GetCurrDir(); //See script in download link above
if (path != '')
path = path + '\\';
alert(path);
document.writeln('<a href="'+path+'teaching.mp3">Click me</a>');
Rob
Post by Boopipi
Hello,
Thanks for your response,
Actually the MP3 will always be in the same directory as the CHM (don't
need to obtain the path). I just need to call up Windows Media Player
(not within the CHM but in its regular window) and have it play the MP3
automatically.
The "getchmdir()" that you pointed out seems to search for and return
the path.
<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">
<PARAM NAME="fileName" VALUE="teaching.mp3">
<PARAM NAME="autoStart" VALUE="true">
<PARAM NAME="showControls" VALUE="true">
</OBJECT>
================================
Post by Rob Chandler [MVP]
So you need to write some script that finds the
location of the Video file. Usually the Video
file is near the CHM so you just find the CHM
path, and add the video filename.
http://helpware.net/FAR/far_faq.htm#Applets
(scroll down a bit to the GetChmDir() function)
Rob
Post by Boopipi
Hello everyone,
I've made a help file with "HTML Help Workshop 4.74"
What I'd like to do is put a link so that when the user clicks on it,
windows media player opens up (not inside the CHM file, but using it's
regular interface) and automatically starts playing an MP3 file in a
fixed file location.
This will never be viewed in a web browser, it will always be a CHM file.
Someone from this group gave me a link, but that link was on embedding
the player inside the CHM file. This I don't want.
Thanks for your time and for any info you can provide.
Boopipi
2010-04-05 01:15:07 UTC
Permalink
In that case, I can go with this.

Thanks
==================
Post by Rob Chandler [MVP]
Hi Peter
The only reliable way we have found is to dynamically
create an absolute path and code at run time.
If you find a better way let us know :-)
XP and Vista good. Win98 (IE4 and HH 1.1)
is very old. If you have problems you may need
to ask users to upgrade to Win98 SE (IE5 and HH 1.21)
or maybe just install a later version of IE which should
also include a later version of HH runtime.
Rob
Loading...