WSH script conversion
From: Scott (scott.69_at_dodgeit.com)
Date: 11/10/04
- Next message: name: "Re: WSH script conversion"
- Previous message: name: "Re: Directory Busy when deleting Computer account"
- Next in thread: name: "Re: WSH script conversion"
- Reply: name: "Re: WSH script conversion"
- Reply: Gerry Hickman: "Re: WSH script conversion"
- Messages sorted by: [ date ] [ thread ]
To: microsoft.public.scripting.wsh Date: Tue, 09 Nov 2004 20:54:09 -0800
firstly, i know nothing of javascript. well, that's not entirely true as i know a bit. anyway, my question is would it be possible to convert this script (found here or pasted below) to a version that i can run in a browser window? basically at the moment the script runs off windows xp (locally) and outputs a message in an alert box, which is great. but, what i'm looking for (or hoping someone might quickly code for me if it's not too hard) is to change the alert box output to "document.write", so that way i can just copy and paste the text from the browser window. i hope i've made myself clear. i'd really appreciate anyone's help with this.
note: rename file above to wmpblog.js from wmpblog.bmp.
// This is a simple JavaScript WSH script to display the currently playing media for
// Windows Media Player 9 Series when the Blogging Plug-in is installed.
// It's a pretty basic sketch of what you'd do, but it is fully functional on my Windows XP SP1,
// and should be easy to extend as you'd like.
//
//
Sh = new ActiveXObject("WScript.Shell");
key = "HKCU\\Software\\Microsoft\\MediaPlayer\\CurrentMetadata"
var strTrackInfo;
var strDisplayString;
var fHaveMetadata = false;
strDisplayString = "The current media is";
try
{
strTrackInfo = Sh.RegRead( key + "\\Title" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " " + strTrackInfo;
}
}
catch( ex )
{
try
{
strTrackInfo = Sh.RegRead( key + "\\Name" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " " + strTrackInfo;
}
}
catch( ex )
{
}
}
try
{
strTrackInfo = Sh.RegRead( key + "\\DurationString" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " (" + strTrackInfo + ")";
}
}
catch( ex )
{
}
try
{
strTrackInfo = Sh.RegRead( key + "\\Author" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " by " + strTrackInfo;
}
}
catch( ex )
{
}
try
{
strTrackInfo = Sh.RegRead( key + "\\Album" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " on the album " + strTrackInfo;
}
}
catch( ex )
{
}
strDisplayString += ".";
if( !fHaveMetadata )
{
strDisplayString = "No media playing currently.";
}
WScript.Echo( strDisplayString );
more info about what this script does can be found here .
- Next message: name: "Re: WSH script conversion"
- Previous message: name: "Re: Directory Busy when deleting Computer account"
- Next in thread: name: "Re: WSH script conversion"
- Reply: name: "Re: WSH script conversion"
- Reply: Gerry Hickman: "Re: WSH script conversion"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|