Discussion:
Playing MP3s thru a .chm file ??
(too old to reply)
Boopipi
2009-09-11 14:46:37 UTC
Permalink
Hello everyone ,

I'd like the user to click on a link in the .chm file, which would bring up
windows media player playing an MP3 file.

The problem is that the HTML help workshop makes the mp3 file part of the
.chm file when I insert "<a href="file.mp3">...</a>" in the HTML code, and
thus blows up the size of the .chm fiile.

How can I do this without the MP3 being made part of the file.

Thanks for your input,

Peter
Ulrich Kulle [MVP]
2009-09-10 18:24:34 UTC
Permalink
Hello Peter,
Post by Boopipi
Hello everyone ,
I'd like the user to click on a link in the .chm file, which would bring up
windows media player playing an MP3 file.
The problem is that the HTML help workshop makes the mp3 file part of the
.chm file when I insert "<a href="file.mp3">...</a>" in the HTML code, and
thus blows up the size of the .chm fiile.
How can I do this without the MP3 being made part of the file.
you may find some information at Rob Chandler's FAQ:
http://www.helpware.net/FAR/far_faq.htm#Applets
--
Best regards
Ulrich Kulle
Microsoft MVP - Help
***********************************
http://www.help-info.de
***********************************
Ulrich Kulle [MVP]
2009-09-10 18:37:03 UTC
Permalink
Hello Peter,

"Boopipi" <***@Reply_In_Newsgroup.com> schrieb im Newsbeitrag news:eL4Z$***@TK2MSFTNGP06.phx.gbl...
one solution may be to start a MP3 file from inside your help topic. Following code is tested with Rob's code and a external mp3
file.
Please see Rob's example download from the link I posted above.

<html>
<head>
<title>MM Test</title>
</head>
<body>

<SCRIPT Language="JScript">
//Return current dir -- '' if in browser or path to CHM if in a CHM
//If in browser then - location.href=file:///d:/path/file.htm
//If in CHM then - location.href=mk:@MSITStore:D:\path\help.chm::/file.htm
function GetCurrDir() {
var X, Y, sl, a, ra, dir;
ra = /::/;
a = location.href.search(ra);
if (a <= 0) //no a CHM - return an empty string
return('');

//find the index of the first colon in the string
ra = /:/;
a = location.href.search(ra);
if (a == 2)
X = 14; //prefix = mk:@MSITStore:
else
X = 7; //prefix = ms-its:

//find last back slash
sl = "\\";
Y = location.href.lastIndexOf(sl);
dir = location.href.substring(X, Y);

//UnEscape path - EG. Replace %20 with spaces
var dir2 = unescape(dir)
return(dir2);
}

</SCRIPT>


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

<p>
Many files do not work from inside a CHM so you must leave them out side and
create an absolute path on the fly to the external file (in the CHM folder).

</html>
--
Best regards
Ulrich Kulle
Microsoft MVP - Help
***********************************
http://www.help-info.de
***********************************
Boopipi
2009-09-11 21:43:07 UTC
Permalink
I will try this, thank you.

The HTML code will only be part of a help project; it will never be a web
page in a browser and the MP3 will always be in the same directory as the
.chm file.

Therefore, I will try to hard code the path into the routine at the very
bottom of this post (the one withthe document.writeln to the media player).
I am an amateur by the way.

Regards,

Peter
___________________________________
Post by Ulrich Kulle [MVP]
Hello Peter,
one solution may be to start a MP3 file from inside your help topic.
Following code is tested with Rob's code and a external mp3 file.
Please see Rob's example download from the link I posted above.
<html>
<head>
<title>MM Test</title>
</head>
<body>
<SCRIPT Language="JScript">
//Return current dir -- '' if in browser or path to CHM if in a CHM
//If in browser then - location.href=file:///d:/path/file.htm
function GetCurrDir() {
var X, Y, sl, a, ra, dir;
ra = /::/;
a = location.href.search(ra);
if (a <= 0) //no a CHM - return an empty string
return('');
//find the index of the first colon in the string
ra = /:/;
a = location.href.search(ra);
if (a == 2)
else
//find last back slash
sl = "\\";
Y = location.href.lastIndexOf(sl);
dir = location.href.substring(X, Y);
//UnEscape path - EG. Replace %20 with spaces
var dir2 = unescape(dir)
return(dir2);
}
</SCRIPT>
<SCRIPT Language="JScript">
var path = GetCurrDir();
if (path != '')
path = path + '\\';
//alert(path);
document.writeln('<OBJECT ID="mediaPlayer"
CLASSID="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95"
TYPE="application/x-oleobject">');
document.writeln('<PARAM NAME="fileName" VALUE="'+path+'Covington.mp3">');
document.writeln('<PARAM NAME="autoStart" VALUE="true"><PARAM
NAME="showControls" VALUE="true"></OBJECT>');
</SCRIPT>
<p>
Many files do not work from inside a CHM so you must leave them out side and
create an absolute path on the fly to the external file (in the CHM folder).
</html>
--
Best regards
Ulrich Kulle
Microsoft MVP - Help
***********************************
http://www.help-info.de
***********************************
Loading...