Jump to content



Photo

Windows Media Player Resumer (WMPR)


  • Please log in to reply
No replies to this topic

#1 jfcby

jfcby

    Geek Problem Solver In The Making...

  • Active Members
  • PipPipPipPipPipPip
  • 327 posts

Posted 12 September 2008 - 02:17 PM

Hello,

Introducing "Windows Media Player Resumer" (WMPR)...
embeds Miscrosoft Windows Media Player (WMP) in AutoIT3. After you've setup WMP and WMPR for the first time then when you start WMP it will find and select the last song that you played. When you close WMPR then it will save the last song played to a specified file (file.config).

I've added a playing list to WMP so that when started in "Now Playing" mode then it is automatically populated in the Now Playing List on the right side of the screen.

It has been test in WMP version 9 and 10 and is not compatible with version 11.

The script was put together with the help of AutoTI3 forum members and the Help File. So I'm offering the script as free and Open Source. It can be changed and modified as needed but all I ask is do not delete my information but add yours when distributing the script.

Plain Text         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> #include <Constants.au3> #include <GuiListView.au3> #cs Title: WMP Resumer Author: James F Cooper & AutoIT3 Forum Members Date: September 8, 2008 Copyright: Free & Open Source - Use and modify as needed but leave my information in tact and add yours. Website: <a href='http://www.coopersbarnyard.net' class='bbc_url' title='External link' rel='nofollow external'>http://www.coopersbarnyard.net</a>  - The Biz Portal Guide! ****** Description ******     Windows Media Player Resumer (WMPR)...     embeds Miscrosoft Windows Media Player (WMP) in AutoIT3. After you've setup WMP and WMPR for the first time then when you start     WMP it will find and select the last song that you played. When you close WMPR then it will save the last song played to a     specified file (file.config). ****** Comments ******     For use with WMP v9 & v10.     Not compatible with WMP v11. ******Updates ******  Features that will be added in future revisions.     Date - Description ****** Bugs ******  Fixes to parts of the program that is not functioning/working properly.     Date - Description  #ce Dim $rData, $fName $hGUI2 = GUICreate('WMP Resumer', 800, 400, 0, 0, BitOr($GUI_SS_DEFAULT_GUI,$WS_CLIPCHILDREN)) $hDrive = @ProgramFilesDir $pID = Run($hDrive & "/Windows Media Player/wmplayer.exe /Task NowPlaying");FileGetShortName("C:\Documents and Settings\User\My Documents\My Downloads\KJBible\mp3\_KJVOldNewTeatament\_KJB.m3u")) WinWait("") Sleep(2000) $hChild = WinGetHandle("Windows Media Player") _WinAPI_SetParent($hChild, $hGUI2) _WinAPI_SetWindowLong($hChild, $GWL_STYLE, $WS_CLIPSIBLINGS) _WinAPI_SetWindowLong($hChild, $GWL_HWNDPARENT, $hGUI2) _WinAPI_SetWindowPos($hChild, 0, 0, 0, 0, 0, BitOr($SWP_SHOWWINDOW, $SWP_NOSIZE)) GUiSetState(@SW_SHOW, $hGUI2) GUISetState(@SW_MAXIMIZE, $hGUI2) WinSetState($hChild, "", @SW_MAXIMIZE) $h = WinGetHandle("[CLASS:WMPlayerApp]") $hwnd = ControlGetHandle($h,"","ATL:SysListView321") fFile() While 1     $msg = GUIGetMsg()     Switch $msg         Case $GUI_EVENT_CLOSE             sFile()             Sleep(2000)             ProcessClose($pID)             Exit         Case Else     EndSwitch WEnd Func wActivate() ;Activate Window     WinActivate($h) EndFunc Func rFile() ;Read File - Perform each time program opens to resume last song play     $fRead = FileOpen("config\file.config",0)     $rData = FileReadLine($fRead)     FileClose($fRead)   EndFunc Func fFile() ;Find File - Perform each time program opens to resume last song play     wActivate()     Sleep(30000)     rFile()     $fFile = _GUICtrlListView_FindText($hwnd, $rData, -1, True)     Sleep(2000)           _GUICtrlListView_ClickItem($hwnd, $fFile, "left", False) EndFunc Func sName() ;Song Name - Gets the current song name when program closes     $fName = _GUICtrlListView_GetItemText($hwnd, _GUICtrlListView_GetNextItem($hwnd))     Sleep(2000) EndFunc     Func sFile() ;Save File - Perform each time program closes     wActivate()     Sleep(2000)     sName()     $fWrite = FileOpen("config\file.config",2)     FileWrite($fWrite,$fName)     FileClose($fWrite) EndFunc


Learning to write scripts,
jfcby
Determined -- Devoted -- DeliveredMake your mind up -- to seriously apply yourself -- accomplishing the desired results._____________________________________________________________________________________A soft answer turneth away wrath: but grievous words stir up anger. Proverbs 15:1 KJB_____________________________________________________________________________________Learning to write scripts...WMP Resumer | InstaPro Launcher | XampLabel Styles | XampPause - "HotKeySet" | XampCounter | XampSpellCheck Forum References Remembered...5 Tips better coder by: Omar AlBadri (AKA - Volly) | AutoIT3/SciTE - USB by: MadSc13ntist | XSkin.au3 GUI by: Valuater AutoIT MVP | Helpful Collection Autoit Scripts: Maintained By: Volly | Windows Help 101 By: beerman & othersMy WebsitesCoopersBarnYard.com | Frankie-Cooper.me










0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users