Hi,
Thank you for your enquiry.
Windows Media Player playlists are saved in SMIL (Synchronised Multimedia Integration Language) and if you open one of these files in Notepad, you should see that they are relatively easy to understand. For example:
Code:
<?wpl version="1.0"?>
<smil>
<head>
<meta name="Generator" content="Microsoft Windows Media Player -- 10.0.0.3646"/>
<author/>
<title>My Playlist</title>
</head>
<body>
<seq>
<media src="C:\\Documents and Settings\User\My Documents\My Music\Track1.mp3" tid="{287CF3F9-ED09-4169-8FB9-B0CC1EC784E1}"/>
<media src="C:\\Documents and Settings\User\My Documents\My Music\Track2.mp3" tid="{287CF3F9-ED09-4169-8FB9-B0CC1EC03E2B}"/>
<media src="C:\\Documents and Settings\User\My Documents\My Music\Track3.mp3" tid="{287CF3F9-ED09-4169-8FB9-B0CC4F2BD2BD}"/>
</seq>
</body>
</smil>
We can see from the above code that each of the <media src> tags specifies a different track in the playlist.
If you know the structure of these playlist files, you can use a series of
Read Line from File actions to retrieve a particular line from the playlist, strip out any unwanted information and store the result to a variable. This variable can then be used in a PlaySound() script action to play the file in question.
For example, on each of the <media src> lines, the first letter of the file path is always the 24th character on the line (including spaces at the start of the line). To determine the end of the path, we can use an
indexOf function to find the next instance of a quotation mark (which will be after the last character of the file path). We can then create a substring of the characters between these two positions and store this to a variable ready for the PlaySound action.
The following code should give you some idea of how these actions will work:
Code:
playlist = OpenFile(SYSTEM_PUBLICATION_DIR+"playlist.wpl")
for (n=0;n<10;n++) {
playlist.ReadLine()
}
audio = playlist.ReadLine()
secondquote = audio.indexOf('"',24)
audio = audio.substring(24,secondquote)
PlaySound(audio)
Kind regards,