lsakizada Posted February 8, 2015 Share Posted February 8, 2015 Hi Guys, The function below does not create an object for me. How do I correct that function so it will run the VLC properly? I have VLC installed BTW: The code is part of the >VLC udf expandcollapse popup; #FUNCTION# ;=============================================================================== ; ; Name...........: _GUICtrlVLC_Create() ; Description ...: Creates a VLC control. ; Syntax.........: _GUICtrlVLC_Create($left, $top, $width, $height) ; Parameters ....: $left - The left side of the control. ; $top - The top of the control. ; $width - The width of the control ; $height - The height of the control ; Return values .: On Success - Returns the identifier (controlID) of the new control. ; On Failure - Returns False. ; Author ........: seangriffin ; Modified.......: ; Remarks .......: This function must be used before any other function in the UDF is used. ; There is currently a clipping problem with the control, where the video ; is overdrawn by any other window that overlaps it. There is no known ; solution at this time. ; ; Related .......: ; Link ..........: ; Example .......: Yes ; ; ;========================================================================================== Func _GUICtrlVLC_Create($left, $top, $width, $height) Local Const $html = _ "<style type=""text/css"">html, body, vlc {margin: 0px; padding: 0px; overflow: hidden;}</style>" & @CRLF & _ "<object classid=""clsid:9BE31822-FDAD-461B-AD51-BE1D1C159921""" & @CRLF & _ "codebase=""http://downloads.videolan.org/pub/videolan/vlc/latest/win32/axvlc.cab""" & @CRLF & _ "width=""" & $width & """ height=""" & $height & """" & @CRLF & _ "id=""vlc"" events=""True"">" & @CRLF & _ "</object>" $oIE = _IECreateEmbedded () $oIEActiveX = GUICtrlCreateObj($oIE, $left, $top, $width-4, $height-4) _IENavigate($oIE, "about:blank") _IEDocWriteHTML($oIE, $html) $vlc = _IEGetObjByName($oIE, "vlc") ; Clear any current VLC errors $oVLCErrorHandler.WinDescription = "" ; Check VLC version info. as a means to determine if the Active X control is installed $vlc.versionInfo() ; If an error (the ActiveX control is not installed), then return False if StringInStr($oVLCErrorHandler.WinDescription, "Unknown name") > 0 Then GUICtrlDelete($oIEActiveX) _IEQuit($oIE) Return False EndIf Return $vlc EndFunc Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 8, 2015 Share Posted February 8, 2015 Can you post the code you use to call this function? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 8, 2015 Author Share Posted February 8, 2015 (edited) Hi Water! Great to get help from you Actually I am running the example that come with the VLC Udf (See the link above). The code is: EDIT: I am running on Win 7 X64 bit. expandcollapse popup#include <GUIConstants.au3> #include <VLC.au3> #include <SliderConstants.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> #Include <GuiSlider.au3> Const $ini_filename = @ScriptDir & "\VLC UDF Example.ini" Dim $msg, $state = 0 Global $position_slider_drag = False, $vlc1, $position_slider, $user_stop = False, $main_gui, $video_path_input _VLCErrorHandlerRegister() ; Setup Main GUI $main_gui = GUICreate("VLC UDF Example", 800, 600, -1, -1) GUICtrlCreateLabel("Video Path", 10, 10, 60, 20) $video_path_input = GUICtrlCreateInput(IniRead($ini_filename, "Main", "videopath", ""), 70, 10, 600, 20) $video_path_button = GUICtrlCreateButton("Select (Insert)", 700, 10, 80, 20) $vlc1 = _GUICtrlVLC_Create(0, 50, 800, 450) if $vlc1 = False then msgbox(0, "VLC UDF Example", "_GUICtrlVLC_Create failed." & @CRLF & _ "The most likely cause is that you don't have VLC installed." & @CRLF & _ "Make sure VLC, and the ActiveX component, is installed.") Exit EndIf $position_slider = GUICtrlCreateSlider(0, 500, 800, 30, $TBS_NOTICKS) $backward_button = GUICtrlCreateButton("Rewind (Arrow Left)", 10, 535, 120, 20) GUICtrlSetState($backward_button, $GUI_DISABLE) $pause_button = GUICtrlCreateButton("Pause (Space)", 160, 535, 80, 20) GUICtrlSetState($pause_button, $GUI_DISABLE) $stop_button = GUICtrlCreateButton("Stop", 280, 535, 80, 20) GUICtrlSetState($stop_button, $GUI_DISABLE) $play_button = GUICtrlCreateButton("Play", 415, 535, 80, 20) GUICtrlSetState($play_button, $GUI_DISABLE) $close_button = GUICtrlCreateButton("Close (Esc)", 550, 535, 80, 20) $forward_button = GUICtrlCreateButton("FForward (Arrow Right)", 670, 535, 120, 20) GUICtrlSetState($forward_button, $GUI_DISABLE) GUICtrlCreateLabel("Video Status", 10, 565, 80, 20) $status_input = GUICtrlCreateInput("", 75, 565, 20, 20) GUICtrlCreateLabel("Volume (F6 && F7)", 310, 565, 80, 20) $volume_slider = GUICtrlCreateSlider(390, 560, 250, 30) GUICtrlSetLimit($volume_slider, 200) GUICtrlSetData($volume_slider, _GUICtrlVLC_GetVolume($vlc1)) $volume_up = GUICtrlCreateDummy() $volume_down = GUICtrlCreateDummy() $mute_button = GUICtrlCreateButton("Mute (F8)", 670, 565, 120, 20) dim $main_gui_accel[8][2]=[["{ESC}", $close_button], ["{RIGHT}", $forward_button], ["{LEFT}", $backward_button], [" ", $pause_button], ["{INSERT}", $video_path_button], ["{F6}", $volume_down], ["{F7}", $volume_up], ["{F8}", $mute_button]] ; Show Main GUI GUISetState(@SW_SHOW) GUISetAccelerators($main_gui_accel) ; Load last video played if StringLen(GUICtrlRead($video_path_input)) > 0 Then UpdateGUIAndPlay(GUICtrlRead($video_path_input)) GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY") if StringLen(GUICtrlRead($video_path_input)) > 0 Then $state = _GUICtrlVLC_GetState($vlc1) if $state = 3 Then GUICtrlSetState($play_button, $GUI_DISABLE) ; Main Loop while 1 ; Get the video state if StringLen(GUICtrlRead($video_path_input)) > 0 Then $state = _GUICtrlVLC_GetState($vlc1) GUICtrlSetData($status_input, $state) EndIf ; Loop a finished video if $state = 6 and $user_stop = False Then UpdateGUIAndPlay() ; Update the video position slider if ($state = 3 or $state = 4) and $position_slider_drag = False Then GUICtrlSetData($position_slider, (_GUICtrlVLC_GetTime($vlc1) / 1000)) $position_slider_drag = False EndIf if $msg = $volume_slider Then _GUICtrlVLC_SetVolume($vlc1, GUICtrlRead($volume_slider)) EndIf if $msg = $volume_down Then $new_vol = _GUICtrlVLC_GetVolume($vlc1) - 10 if $new_vol < 0 then $new_vol = 0 _GUICtrlVLC_SetVolume($vlc1, $new_vol) GUICtrlSetData($volume_slider, $new_vol) EndIf if $msg = $volume_up Then $new_vol = _GUICtrlVLC_GetVolume($vlc1) + 10 if $new_vol > 200 then $new_vol = 200 _GUICtrlVLC_SetVolume($vlc1, $new_vol) GUICtrlSetData($volume_slider, $new_vol) EndIf if $msg = $mute_button Then if _GUICtrlVLC_GetMute($vlc1) = True Then _GUICtrlVLC_SetMute($vlc1, False) Else _GUICtrlVLC_SetMute($vlc1, True) EndIf EndIf if $msg = $video_path_button Then $video_path = FileOpenDialog("VLC UDF Example - Select Video", "C:\", "Videos (*.avi;*.flv;*.mp4)", 3) if StringLen($video_path) > 0 Then UpdateGUIAndPlay($video_path) EndIf if $msg = $forward_button Then _GUICtrlVLC_SeekRelative($vlc1, 5000) EndIf If $msg = $backward_button Then _GUICtrlVLC_SeekRelative($vlc1, -5000) EndIf if $msg = $pause_button Then _GUICtrlVLC_Pause($vlc1) EndIf if $msg = $stop_button Then _GUICtrlVLC_Stop($vlc1) $user_stop = True GUICtrlSetState($backward_button, $GUI_DISABLE) GUICtrlSetState($forward_button, $GUI_DISABLE) GUICtrlSetState($pause_button, $GUI_DISABLE) GUICtrlSetState($stop_button, $GUI_DISABLE) GUICtrlSetState($play_button, $GUI_ENABLE) EndIf if $msg = $play_button Then $user_stop = False $vlc1.playlist.play() GUICtrlSetState($backward_button, $GUI_ENABLE) GUICtrlSetState($forward_button, $GUI_ENABLE) GUICtrlSetState($pause_button, $GUI_ENABLE) GUICtrlSetState($stop_button, $GUI_ENABLE) GUICtrlSetState($play_button, $GUI_DISABLE) EndIf If $msg = $GUI_EVENT_CLOSE or $msg = $close_button Then IniWrite($ini_filename, "Main", "videopath", GUICtrlRead($video_path_input)) ExitLoop EndIf $msg = GUIGetMsg() WEnd Func UpdateGUIAndPlay($path = "") GUICtrlSetState($play_button, $GUI_DISABLE) if StringLen($path) > 0 Then GUICtrlSetData($video_path_input, $path) _GUICtrlVLC_Clear($vlc1) _GUICtrlVLC_Play($vlc1, _GUICtrlVLC_Add($vlc1, GUICtrlRead($video_path_input))) Else _GUICtrlVLC_Play($vlc1, 0) EndIf While _GUICtrlVLC_GetState($vlc1) <> 3 WEnd GUICtrlSetLimit($position_slider, (_GUICtrlVLC_GetLength($vlc1) / 1000)) GUICtrlSetData($position_slider, 0) $position_slider_drag = False GUICtrlSetState($backward_button, $GUI_ENABLE) GUICtrlSetState($forward_button, $GUI_ENABLE) GUICtrlSetState($pause_button, $GUI_ENABLE) GUICtrlSetState($stop_button, $GUI_ENABLE) GUICtrlSetState($play_button, $GUI_DISABLE) EndFunc Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam) #forceref $hWnd, $iMsg, $iwParam Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndSlider $hWndSlider = $position_slider If Not IsHWnd($position_slider) Then $hWndSlider = GUICtrlGetHandle($position_slider) $tNMHDR = DllStructCreate($tagNMHDR, $ilParam) $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom")) $iIDFrom = DllStructGetData($tNMHDR, "IDFrom") $iCode = DllStructGetData($tNMHDR, "Code") Switch $hWndFrom Case $hWndSlider Switch $iCode case $NM_CUSTOMDRAW $position_slider_drag = True Case $NM_RELEASEDCAPTURE _GUICtrlVLC_SeekAbsolute($vlc1, (GUICtrlRead($position_slider) * 1000)) $position_slider_drag = False EndSwitch EndSwitch Return $GUI_RUNDEFMSG EndFunc Edited February 8, 2015 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 8, 2015 Share Posted February 8, 2015 I tried the example script on a Windows system where VLC is not available. Strange enough the example script doesn't grab this error (it should). I tested with AutoIt 3.3.12.0 and 3.3.8.1 My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 8, 2015 Author Share Posted February 8, 2015 This code is failing _IEDocWriteHTML($oIE, $html) I am running on x64, Win7. Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 8, 2015 Share Posted February 8, 2015 Which version of AutoIt do you run? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 9, 2015 Author Share Posted February 9, 2015 Which version of AutoIt do you run? Autoit 3.3.12.0 Beta: 3.3.13.19 Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 9, 2015 Share Posted February 9, 2015 This code is failing _IEDocWriteHTML($oIE, $html) I am running on x64, Win7. What does "failing" mean? Do you get an error message on the console? What is the value of @error after calling the function? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 9, 2015 Author Share Posted February 9, 2015 (edited) What does "failing" mean? Do you get an error message on the console? What is the value of @error after calling the function? When running the example script, the $vlc1 returned as false from call to: _GUICtrlVLC_Create(0, 50, 800, 450) I suspect that this code _IEDocWriteHTML($oIE, $html) is not working from some reason $vlc1 = _GUICtrlVLC_Create(0, 50, 800, 450) if $vlc1 = False then msgbox(0, "VLC UDF Example", "_GUICtrlVLC_Create failed." & @CRLF & _ "The most likely cause is that you don't have VLC installed." & @CRLF & _ "Make sure VLC, and the ActiveX component, is installed.") Exit EndIf Edited February 9, 2015 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 9, 2015 Share Posted February 9, 2015 Can you insert a MsgBox(0, "", @error) after_IEDocWriteHTML($oIE, $html)? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 9, 2015 Author Share Posted February 9, 2015 (edited) Can you insert a MsgBox(0, "", @error) after_IEDocWriteHTML($oIE, $html)? It's return "0" Edit: BTW: I have Internet Explorer 10.0.9200, update 10.0.22 Edited February 9, 2015 by lsakizada Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 9, 2015 Share Posted February 9, 2015 As it returns 0 (no error) how do you know "is not working from some reason"? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
lsakizada Posted February 9, 2015 Author Share Posted February 9, 2015 As it returns 0 (no error) how do you know "is not working from some reason"? Well I got you! I think the VLC Active X control is not installed! Be Green Now or Never (BGNN)! Link to comment Share on other sites More sharing options...
water Posted February 9, 2015 Share Posted February 9, 2015 But shouldn't trigger this an error as well? My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki 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