kjactive Posted July 3, 2005 Share Posted July 3, 2005 Just another embedded activeX object to play around with - RealPlayer A small interfase with controls to link you up on tags page and example on how to control the medieplay component... expandcollapse popup; Author: Kåre Johansson ; AutoIt Version: 3.1.1.55 ; Description: Very Simple example: Embedding Real's RealPlayer object ; Date: 3 jul 2005 #include <GUIConstants.au3> $oRP = ObjCreate("rmocx.RealPlayer G2 Control.1") GUICreate ( "Embedded Web control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS)) $TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER) GuiCtrlSetFont($TagsPageC,9,400,4) GuiCtrlSetColor($TagsPageC,0x0000ff) GuiCtrlSetCursor($TagsPageC,0) $AboutC = GUICtrlCreateButton('About',105,177,70,20) $PrefsC = GUICtrlCreateButton('Preferences',175,177,70,20) $StatC = GUICtrlCreateButton('Statistics',245,177,70,20) $GUIActiveX = GUICtrlCreateObj( $oRP, 10, 10 , 300 , 160 ) $LinkoRP = ObjEvent($oRP,"IEEvent_","FolderView"); this is a dummy event handle GUISetState ();Show GUI With $oRP; Object tag pool ;.Source = "http://cinecast.capcave.com/streams/SkyRadio/SkyRadio.asx" .Source = "C:\Music\track 00.mpga" .DoPlay() ;.DoPause() .SetNumLoop(2) .SetVolume(100) EndWith While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $TagsPageC Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B46067C-FD87-49B6-8DDD-12F0D687035F}','', @SW_HIDE) Case $msg = $AboutC $oRP.AboutBox() Case $msg = $PrefsC $oRP.EditPreferences() Case $msg = $StatC $oRP.HideShowStatistics() EndSelect WEnd GUIDelete () Exit The example needs RealPlayer ( free to download ) and something like beta 3.1.55 and a mp3 song or something to play, almost no limits... kjactive Au3PP 4.1 - Autoit3 preprocessor, optimize speed, performance to scripts and do executes....[/url]Au3Calibur - Create libraries of commonly used code excerptsWords manipulate UDF, functions that is lent from the rexx language, topics and index file includedCustomDialog UDF to include custom made dialogs like a extended colorpick requester to scripts...[url="ftp://fritidshjemmet.com/Autoit3/SysColor.zip"]SysColor UDF a low level color library to manipulate RGB and Hex values...Shell32 UDF to Automate Windows® operating tasks from native dialog and Wizards browsers... Optimized the CodeWicard with options to generate browser code etc... Link to comment Share on other sites More sharing options...
ralnee Posted April 19, 2006 Share Posted April 19, 2006 kjactive.....I'm playing around with your realplayer code (which I think is pretty cool...) and modified it a bit...I'm having a problem with command line arguments. The strange thing is everything works fine in script mode, but when I complie, it flips an ocx error.. The error comes in because the ocx doesn't see the 3rd command line argument (url of ram file)...I hope you can help..Thanksrun examples in dos box:play.au3 /play http://www.soul-patrol.net/brew1.ram ->>>Works greatplay.exe /play http://www.soul-patrol.net/brew1.ram ->>>ocx can adjust sound vol ( looks like it can't find url and fails)expandcollapse popup;Use Beta #include <GUIConstants.au3> #include <File.au3> #include <GuiListView.au3> Global $cancelbutton, $msg, $__msgbox, $oIE, $GUIActiveX Global $TagsPageC, $AboutC, $PrefsC, $StatC, $Pause_Button, $PLAY, $LinkoRP, $URL_FILE Global $oRP, $title, $trackview, $tracks, $tracklist, $RA $URL_FILE = $CmdLine[$CmdLine[0]] Opt("GUICloseOnESC", 1) $oRP = ObjCreate("rmocx.RealPlayer G2 Control.1") $RA = GUICreate ( "Embedded Web control Test", 320, 200, -1, -1,BitOr($WS_OVERLAPPEDWINDOW,$WS_VISIBLE,$WS_CLIPSIBLINGS)) $TagsPageC = GuiCtrlCreateLabel('Visit Tags Page', 5, 180, 100, 15, $SS_CENTER) GuiCtrlSetFont($TagsPageC,9,400,4) GuiCtrlSetColor($TagsPageC,0x0000ff) GuiCtrlSetCursor($TagsPageC,0) $AboutC = GUICtrlCreateButton('About',105,177,70,20) $PrefsC = GUICtrlCreateButton('Preferences',175,177,70,20) $StatC = GUICtrlCreateButton('Statistics',245,177,70,20) $Pause_Button = GUICtrlCreateButton('Pause',45,150,70,20) $PLAY = GUICtrlCreateButton('Play',130,150,70,20) $LinkoRP = ObjEvent($oRP,"IEEvent_","FolderView"); this is a dummy event handle $running = "true" GUISetState ();Show GUI With $oRP; Object tag pool .Source = $CmdLine[$CmdLine[0]] .DoPlay() .SetVolume(100) EndWith While 1 If $oRP.GetPacketsReceived > 100 Then $title = StringSplit($oRP.GetEntryAbstract(1), ":") If @error Then $title = StringSplit($oRP.GetEntryTitle(1), "-") If Not @error Then _make_real_gui($title) Else GuiCtrlCreateLabel("Soul-Patrol.net Radio Show" & @CRLF & @CRLF & "No Listings Available", 18, 30, 220, 120) EndIf Else _make_real_gui($title) EndIf ExitLoop EndIf WEnd While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE $oRP.DoStop() GUIDelete ($RA) $running = "false" ExitLoop Case $msg = $TagsPageC Run(@ComSpec & ' /c start http://www.myplugins.info/guids/typeinfo/typeinfo.php?clsid={3B46067C-FD87-49B6-8DDD-12F0D687035F}','', @SW_HIDE) Case $msg = $AboutC $oRP.AboutBox() Case $msg = $PrefsC $oRP.EditPreferences() Case $msg = $StatC $oRP.HideShowStatistics() Case $msg = $Pause_Button $oRP.DoPause() Case $msg = $PLAY $oRP.DoPlay() EndSelect WEnd GUIDelete () Exit Func _make_real_gui($title) GuiCtrlCreateLabel($title[1],15, 10, 170, 12) $trackview = GuiCtrlCreateListView ("Tracks |",18, 30, 270, 102, $LVS_EX_FLATSB) _GUICtrlListViewSetColumnWidth($trackview,0,220) $tracks = StringSplit($title[2],",") For $t = 1 To $tracks[0] $tracklist = GuiCtrlCreateListViewItem($tracks[$t],$trackview) Next EndFunc Link to comment Share on other sites More sharing options...
ptrex Posted April 20, 2006 Share Posted April 20, 2006 @ralnee If you use an ActiveX component you should include proper Error handling. This makes life easier in case of proplems. To start the scritp use this #include <GUIConstants.au3> Dim $oMyError $oRP = ObjCreate("rmocx.RealPlayer G2 Control.1") ; Check if object creation succeeded If Not IsObj($oRP) Then MsgBox(16, "ActiveX Error", "Real Player Object creation failed." & @CRLF & _ "Please verify the installation of Real Player.") Exit EndIf To End the script ;This is Sven P's custom error handler Func MyErrFunc() $HexNumber=hex($oMyError.number,8) Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !" & @CRLF & @CRLF & _ "err.description is: " & @TAB & $oMyError.description & @CRLF & _ "err.windescription:" & @TAB & $oMyError.windescription & @CRLF & _ "err.number is: " & @TAB & $HexNumber & @CRLF & _ "err.lastdllerror is: " & @TAB & $oMyError.lastdllerror & @CRLF & _ "err.scriptline is: " & @TAB & $oMyError.scriptline & @CRLF & _ "err.source is: " & @TAB & $oMyError.source & @CRLF & _ "err.helpfile is: " & @TAB & $oMyError.helpfile & @CRLF & _ "err.helpcontext is: " & @TAB & $oMyError.helpcontext _ ) SetError(1) ; to check for after this function returns Endfunc Enjoy Contributions :Firewall Log Analyzer for XP - Creating COM objects without a need of DLL's - UPnP support in AU3Crystal Reports Viewer - PDFCreator in AutoIT - Duplicate File FinderSQLite3 Database functionality - USB Monitoring - Reading Excel using SQLRun Au3 as a Windows Service - File Monitor - Embedded Flash PlayerDynamic Functions - Control Panel Applets - Digital Signing Code - Excel Grid In AutoIT - Constants for Special Folders in WindowsRead data from Any Windows Edit Control - SOAP and Web Services in AutoIT - Barcode Printing Using PS - AU3 on LightTD WebserverMS LogParser SQL Engine in AutoIT - ImageMagick Image Processing - Converter @ Dec - Hex - Bin -Email Address Encoder - MSI Editor - SNMP - MIB ProtocolFinancial Functions UDF - Set ACL Permissions - Syntax HighLighter for AU3ADOR.RecordSet approach - Real OCR - HTTP Disk - PDF Reader Personal Worldclock - MS Indexing Engine - Printing ControlsGuiListView - Navigation (break the 4000 Limit barrier) - Registration Free COM DLL Distribution - Update - WinRM SMART Analysis - COM Object Browser - Excel PivotTable Object - VLC Media Player - Windows LogOnOff Gui -Extract Data from Outlook to Word & Excel - Analyze Event ID 4226 - DotNet Compiler Wrapper - Powershell_COM - New Link to comment Share on other sites More sharing options...
ralnee Posted April 21, 2006 Share Posted April 21, 2006 Thanks for your help.. When I added the error checking , it comes up with this COM error: error.windescription: "No such interface supported" error.number is: 80004002 I tried looking this error number up on the web, but really go nothing....So, I said what the heck and complied your script, unmodified (hard coding the url for the rm file), and got the same error...... Any ideas would be welcome Thanks Link to comment Share on other sites More sharing options...
ralnee Posted April 21, 2006 Share Posted April 21, 2006 I stand corrected. Your script compiles and run under the released version, not the beta.....My bad....I wonder if theres something different between how activex works between the released and beta....hmmmm 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