mathew Posted August 14, 2009 Share Posted August 14, 2009 Hey, is there any way to control the Windows Media Player? I just want to add files (I have the path of them) to the actual playlist. Its ment for a party. My laptop accepts datatransfer via bluetooth. A AutoIt script should scan the default savedirectory whether there is a new file, move it to another folder and add it to the playlist. Everything workes besides the adding to the playlist. May someone help me please? Thanks for answers. Best Regards, Matthias Link to comment Share on other sites More sharing options...
Szhlopp Posted August 14, 2009 Share Posted August 14, 2009 Hey, is there any way to control the Windows Media Player? I just want to add files (I have the path of them) to the actual playlist. Its ment for a party. My laptop accepts datatransfer via bluetooth. A AutoIt script should scan the default savedirectory whether there is a new file, move it to another folder and add it to the playlist. Everything workes besides the adding to the playlist. May someone help me please? Thanks for answers. Best Regards, Matthias This isn't 100% what you need. However, it does do what it's supposed to. ALL this does is edit the .wpl media player uses to include another file. It doesn't refresh WMP though, so you may need to click the list or find some way to make itself refresh what it has. expandcollapse popup#include <File.au3> ; _WMPlaylistAdd("Convertlist3", "E:\NapsterDownloads\Thousand Foot Krutch\The Art of Breaking\Thousand Foot Krutch - Breathe You In.wma") Func _WMPlaylistAdd($sPlaylist, $sTrack) Local $Path ; Get the path If FileExists(@UserProfileDir & '\music\playlists\' & $sPlaylist & ".wpl") = 1 Then $Path = @UserProfileDir & '\music\playlists\' & $sPlaylist & ".wpl" ElseIf FileExists($sPlaylist) = 1 Then $Path = $sPlaylist Else SetError(1) Return 0 EndIf ;Read it $FileText = FileRead($Path) ; Get the items $CurrentItems = StringRegExp($FileText, '<media src="(.*?)"', 3) $FirstHalf = StringSplit($FileText, "<seq>", 1) $FirstHalf = $FirstHalf[1] & "<seq>" & @CRLF For $I = 0 To UBound($CurrentItems) - 1 $FirstHalf &= ' <media src="' & $CurrentItems[$I] & '"/>' & @CRLF Next ; Add in the new item $FirstHalf &= ' <media src="' & $sTrack & '"/>' & @CRLF $FirstHalf &= ' </seq>' & @CRLF & ' </body>' & @CRLF & '</smil>' & @CRLF FileDelete($Path) FileWrite($Path, $FirstHalf) EndFunc 1 param - Playlist name OR complete playlist path 2 param - Complete path to the file you want to add Good luck man. Sorry I can't do more! RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now