AuToItItAlIaNlOv3R Posted March 9, 2010 Share Posted March 9, 2010 Hi, i made a program that allow to play web radio, now i would like to calculate bitrate of .asx file. For example i've this code : #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1 = GUICreate("Test", 145, 97, 302, 69) $Button1 = GUICtrlCreateButton("Play", 8, 8, 131, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 8, 40, 131, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Kb/s", 104, 72, 27, 17) $Label2 = GUICtrlCreateLabel("", 56, 72, 4, 4) $Label3 = GUICtrlCreateLabel("Bitrate", 8, 72, 34, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $gMediaObject = _CreateWMPlayer() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gMediaObject.URL = "http://xxxx/xxxx.asx" ; i would like to send in $Label2 the bitrate how can i do this? EndSwitch WEnd Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer Now i would like to send in $Label2 the bitrate how can i do this? Thank's a lot! Link to comment Share on other sites More sharing options...
doudou Posted March 10, 2010 Share Posted March 10, 2010 Now i would like to send in $Label2 the bitrate how can i do this? Try this: $bitrate = $gMediaObject.CurrentMedia.GetItemInfo("bitrate") ; byte/s $bitrate = Round(Number($bitrate) / 1024, 2) GUICtrlSetData($Label2, "" & $bitrate) UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted March 10, 2010 Author Share Posted March 10, 2010 It don't work, the code give me 0kb/s with all radio! Another solution? Thank's a lot! Link to comment Share on other sites More sharing options...
doudou Posted March 11, 2010 Share Posted March 11, 2010 It don't work, the code give me 0kb/s with all radio! Another solution?This is the right solution! Your script has to wait until the media has loaded before you can read its attributes. UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
AuToItItAlIaNlOv3R Posted March 12, 2010 Author Share Posted March 12, 2010 Dont work for me this is the code, when i add you code #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Test", 146, 98, 302, 69) $Button1 = GUICtrlCreateButton("Play", 8, 8, 131, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 8, 40, 131, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Kb/s", 104, 72, 27, 17) $Label2 = GUICtrlCreateLabel("", 56, 72, 44, 20) $Label3 = GUICtrlCreateLabel("Bitrate", 8, 72, 34, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $gMediaObject = _CreateWMPlayer() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gMediaObject.URL = "mms://85.248.7.162/EXPRES_LQ" $bitrate = $gMediaObject.CurrentMedia.GetItemInfo("bitrate") ; byte/s $bitrate = Round(Number($bitrate) / 1024, 2) GUICtrlSetData($Label2, "" & $bitrate) ; i would like to send in $Label2 the bitrate how can i do this? EndSwitch WEnd Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer It give me with all radio, bitrate 0 kbs... Another solution? Hi! Link to comment Share on other sites More sharing options...
BrettF Posted March 12, 2010 Share Posted March 12, 2010 You're not listening to himFirst point this is the wrong forum. Did you happen to miss the bit that said AutoItX, the COM/ActiveX version of AutoIt?Example of going about it.expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Test", 146, 98, 302, 69) $Button1 = GUICtrlCreateButton("Play", 8, 8, 131, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 8, 40, 131, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Kb/s", 104, 72, 27, 17) $Label2 = GUICtrlCreateLabel("", 56, 72, 44, 20) $Label3 = GUICtrlCreateLabel("Bitrate", 8, 72, 34, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $gMediaObject = _CreateWMPlayer() $timer = TimerInit () $CURRENTLY_PLAYING = False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gMediaObject.URL = "mms://85.248.7.162/EXPRES_LQ" $gMediaObject.Controls.play $CURRENTLY_PLAYING = TRUE EndSwitch If $CURRENTLY_PLAYING Then If TimerDiff ($timer) >= 1000 Then GUICtrlSetData($Label2, Round(Number($gMediaObject.CurrentMedia.GetItemInfo("bitrate")) / 1024, 2)) $timer = TimerInit () EndIf EndIf WEnd Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
doudou Posted March 12, 2010 Share Posted March 12, 2010 First point this is the wrong forum. Did you happen to miss the bit that said AutoItX, the COM/ActiveX version of AutoIt? Yeah, he posted his question all around the place in different forums. Example of going about it. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Test", 146, 98, 302, 69) $Button1 = GUICtrlCreateButton("Play", 8, 8, 131, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 8, 40, 131, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Kb/s", 104, 72, 27, 17) $Label2 = GUICtrlCreateLabel("", 56, 72, 44, 20) $Label3 = GUICtrlCreateLabel("Bitrate", 8, 72, 34, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $gMediaObject = _CreateWMPlayer() $timer = TimerInit () $CURRENTLY_PLAYING = False While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gMediaObject.URL = "mms://85.248.7.162/EXPRES_LQ" $gMediaObject.Controls.play $CURRENTLY_PLAYING = TRUE EndSwitch If $CURRENTLY_PLAYING Then If TimerDiff ($timer) >= 1000 Then GUICtrlSetData($Label2, Round(Number($gMediaObject.CurrentMedia.GetItemInfo("bitrate")) / 1024, 2)) $timer = TimerInit () EndIf EndIf WEnd Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer This should work. Another approach is to listen for PlayStateChange event: expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <StaticConstants.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form1_1 = GUICreate("Test", 146, 98, 302, 69) $Button1 = GUICtrlCreateButton("Play", 8, 8, 131, 25, $WS_GROUP) $Button2 = GUICtrlCreateButton("Stop", 8, 40, 131, 25, $WS_GROUP) $Label1 = GUICtrlCreateLabel("Kb/s", 104, 72, 27, 17) $Label2 = GUICtrlCreateLabel("", 56, 72, 44, 20) $Label3 = GUICtrlCreateLabel("Bitrate", 8, 72, 34, 17) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### $gMediaObject = _CreateWMPlayer() ObjEvent($gMediaObject, "WMPEvent_", "PlayStateChange") While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 $gMediaObject.URL = "mms://85.248.7.162/EXPRES_LQ" $gMediaObject.Controls.play EndSwitch WEnd Func _CreateWMPlayer() $Object = ObjCreate("WMPlayer.OCX.7") $Object.URL = "" Return $Object EndFunc ;==>_CreateWMPlayer Func WMPEvent_PlayStateChange($newState) If 3 = $newState Then Local $bitrate = $gMediaObject.CurrentMedia.GetItemInfo("bitrate") ; byte/s $bitrate = Round(Number($bitrate) / 1024, 2) GUICtrlSetData($Label2, "" & $bitrate) EndIf EndFunc UDFS & Apps: Spoiler DDEML.au3 - DDE Client + ServerLocalization.au3 - localize your scriptsTLI.au3 - type information on COM objects (TLBINF emulation)TLBAutoEnum.au3 - auto-import of COM constants (enums)AU3Automation - export AU3 scripts via COM interfacesTypeLibInspector - OleView was yesterday Coder's last words before final release: WE APOLOGIZE FOR INCONVENIENCEĀ Link to comment Share on other sites More sharing options...
BrettF Posted March 13, 2010 Share Posted March 13, 2010 Yeah, he posted his question all around the place in different forums.Ugh. The impatience of some people... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! 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