View Full Version : Looking for a way for AMS5 to find Default music Player
clientele
12-08-2004, 03:06 AM
Looking for a way for AMS5 to find Default music Player, also once that program is executed I would like it to also play the CD from the source drive where the AMS5 disc is located . Hope im not asking to much..this is the script I have so far but no luck, im really stuck from here. Any help would help:) thanks.
File.Run("C:\\Program Files\\Windows Media Player\\wmplayer.exe", "play _SourceDrive", "", SW_SHOWNORMAL, false);
If I understand correctly, that you want an audio file on your source disk to play using the user’s default music player, all you need to do is use the File.Open command to open the audio file in question. The user’s machine should take care of picking and starting the user’s preferred or ‘default’ music player.
Stefan_M
12-08-2004, 07:36 AM
see function:
string File.GetDefaultViewer (string FileExtension )
Stefan_M
clientele
12-08-2004, 11:16 AM
If I understand correctly, that you want an audio file on your source disk to play using the user’s default music player, all you need to do is use the File.Open command to open the audio file in question. The user’s machine should take care of picking and starting the user’s preferred or ‘default’ music player.
Almost correct, but what I would want to have open is the CD audio tracks on the source CD not an audio file. Thanks for responding.
TJ_Tigger
12-08-2004, 12:11 PM
The file extensions for CD Audio tracks is .cda. You could do what Stefan_M says and to this
strCDA = File.GetDefaultViewer("cda")
to find the default viewer for the system. In my case it returns the path and exe for winamp.
but as JimS mentions you could do this
File.Open(_SourceDrive .. "\\Track01.cda", "", SW_SHOWNORMAL);
This is assuming that the track is labled as such.
As another idea you could probably create a playlist for WMP or WinAmp and load that instead.
a .wpl for WMP uses XML. Here is a sample of what the file looks like
<?wpl version="1.0"?>
<smil>
<head>
<meta name="Generator" content="Microsoft Windows Media Player -- 10.0.0.3646"/>
<title>Playlist1</title>
</head>
<body>
<seq>
<media src="f:\Track01.cda"/>
<media src="f:\Track02.cda"/>
<media src="f:\Track03.cda"/>
<media src="f:\Track04.cda"/>
<media src="f:\Track05.cda"/>
<media src="f:\Track06.cda"/>
<media src="f:\Track07.cda"/>
<media src="f:\Track08.cda"/>
<media src="f:\Track09.cda"/>
</seq>
</body>
</smil>
I would not hard code the directory like above. Hopefully WMP supports relative paths.
I am sure that Microsoft has information about the full format for this xml file. If you have the XML plugin you could build this file on the fly as well. That could be a cool feature. If you don't have the XML plugin you could still build it easily using the TextFile.WriteFromString.
WinAmp is even easier as far as playlists go. The .m3u is a simple text file with a list of the files you want to play.
I don't know if something like this would work. The code has not been tested, but hopefully it will give you an idea of what to play with. If I have time maybe I will give it a shot here.
strCDA = File.GetDefaultViewer("cda")
if String.SplitPath(strCDA).Filename == "wmplayer" then
File.Open(_SourceDrive.."\\Playlist1.wpl", "", SW_SHOWNORMAL)
else
File.Run("C:\\Program Files\\Windows Media Player\\wmplayer.exe", _SourceDrive.."Playlist.wpl", "", SW_SHOWNORMAL, false);
end
Good Luck
Tigg
TJ_Tigger
12-08-2004, 12:13 PM
BTW here is a link to Microsoft that talks about WMP File Formats.
http://support.microsoft.com/default.aspx?scid=kb;[LN];316992
TJ_Tigger
12-08-2004, 12:57 PM
It seems that .wpl is a propreitary format used by WMP and the tags are not posted anywhere. But if you would like to try and hack your way through the samples. I have provided them here. They are on any machine with WMP. I found these in c:\Windows\Service Packs\i386. It looks like WMP keeps track of songs you listen to and allows you to query the data to create playlists. I wonder what else they track without us knowing. Kind of scary.
clientele
12-08-2004, 01:04 PM
TJ Tigger wow I knew you would help out thanks im gonna try these and let you know how it turns out, thanks also to everyone else.
TJ_Tigger
12-08-2004, 01:13 PM
TJ Tigger wow I knew you would help out thanks im gonna try these and let you know how it turns out, thanks also to everyone else.
clientele,
Once you get it running, if you can, please post your solution here so people can see what you ended up doing.
Thx
Tigg
clientele
12-08-2004, 01:44 PM
I think in my rush to find a solution I forgot to mention this would be a data/audio or enhanced cd would this change how this script works?
File.Open(_SourceDrive .. "\\Track01.cda", "", SW_SHOWNORMAL);
TJ_Tigger
12-08-2004, 01:48 PM
I think in my rush to find a solution I forgot to mention this would be a data/audio or enhanced cd would this change how this script works?
File.Open(_SourceDrive .. "\\Track01.cda", "", SW_SHOWNORMAL);
It shouldn't. In an Enhanced CD the Audio tracks are burned on the CD first so they can be played by most audio CD Players.
Tigg
TJ_Tigger
12-08-2004, 02:32 PM
This is from a MS newsgroup. You could use this in File.Run
wmplayer /play "c:\my playlists\wakeup.wpl"
vBulletin® v3.8.4, Copyright ©2000-2009, Jelsoft Enterprises Ltd.