Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Remember last volume

$
0
0
Hi,

I am using windows media player object for my audio player.

I need my player to remember the last set volume on the player if  possible.

I can use an INI file to store the last audio volume but i do not know how to get the current volume to store it on exiting the window.

Any help would be appreciated.

Regards Ajit

[ autoit ]         
#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> ;*** Build GUI: Opt("GUIOnEventMode", 1) #Region ### START Koda GUI section ### Form=C:\WinSpr\AutoIt\_Eigenes\COMStati.kxf $Form1 = GUICreate("Media Player", 600, 400, -1, -1, $WS_SYSMENU) GUISetOnEvent($GUI_EVENT_CLOSE, "Form1Close") $File_Path = GUICtrlCreateInput("", 10, 100, 300) $Browse_Btn = GUICtrlCreateButton("...", 315, 100, 20, 20) GUIctrlSetOnEvent($Browse_Btn, "browse") Global $oRP $oRP = ObjCreate("MediaPlayer.MediaPlayer.1") If Not IsObj($oRP) Then MsgBox(48, "ERROR...", "object failed") Exit EndIf $GUIActiveX = GUICtrlCreateObj($oRP, 10, -220, 280, 285) $oRPEvt = ObjEvent($oRP, "MediaPlayer_") With $oRP; Object tag pool .Rate = 10 .AutoStart = False .playcount = 0; 0,1,2,3 .displaysize = True .windowlessVideo = True .showControls = True .EnableContextMenu = True .ShowPositionControls = True ;~ .ShowStatusBar = True .ShowTracker = True .EnableTracker = True .showaudiocontrols = True .EnablePositionControls = True .Enabled = True .ShowDisplay = False .ShowGotoBar = False .Mute = False .Filename = "" ;~ .play ;.Play; .stop .pause ConsoleWrite(.openState & @CRLF); 0 Not ready, 6 Playing ConsoleWrite(.currentPosition) ConsoleWrite(.duration & @CRLF) ConsoleWrite(.PlayState & @CRLF); 0 Stopped, 1 Pause, 2 playing ;~ .SendKeyboardEvents = true .ClickToPlay = False .AutoRewind = False .CurrentPosition = 0 ;.volume = 0; -10000 ;~ .volume = -9000; -10000 ;~ .balance = -10000; -10000 ;~ .AboutBox EndWith GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $oRP.ShowPositionControls = True Consolewrite($oRP.volume & @CRLF) Sleep(100) WEnd Func Form1Close() Exit EndFunc Func browse() $var = FileOpenDialog("Select file to play", @DesktopDir& "\", "Images (*.mp3;*.wav)");, 1 + 4 ) GUICtrlSetData($File_Path, $var ) $oRP.Filename = $var EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>