CYCho Posted March 14, 2022 Share Posted March 14, 2022 (edited) I have the following code which works fine in v3.3.14.5: expandcollapse popup#include <GuiConstants.au3> #include <IE.au3> Global $videoWidth = 800, $videoHeight = 450 Global $videoGUI = GUICreate("Video Control", $videoWidth, $videoHeight, 0, 0, $WS_OVERLAPPEDWINDOW) GUISetState() Global $IEControl Global $oIE = MyWMPlayer() Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") $oPlayer.Settings.autoStart = True $oPlayer.URL = "FileFullPath.mp4" Sleep(3000) While 1 $guiMsg = GUIGetMsg() If $oPlayer.playState <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit WEnd Func MyWMPlayer() ; create an IE-embedded WMP object Local $myIE_Obj = _IECreateEmbedded () $IEControl = GUICtrlCreateObj($myIE_Obj, 0, 0, $videoWidth, $videoHeight) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ; 1 _IENavigate($myIE_Obj, "about:blank") Local $htmlWMP = '' _ & @CR & '<body style="margin:0; padding:0">' _ & @CR & '<OBJECT ' _ & @CR & 'ID="objWMPlayer"' _ & @CR & 'WIDTH="' & $videoWidth & '"' _ & @CR & 'HEIGHT="' & $videoHeight & '"' _ & @CR & 'CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"' _ & @CR & 'TYPE="application/x-ms-wmp">' _ & @CR & '<PARAM NAME="enableContextMenu" VALUE="true">' _ & @CR & '<PARAM NAME="enableFullScreenControls" VALUE="true">' _ & @CR & '<PARAM NAME="stretchToFit" VALUE="true">' _ & @CR & '</OBJECT>' _ & @CR & '</body>' _IEDocWriteHTML ($myIE_Obj, $htmlWMP) _IEAction ($myIE_Obj, "refresh") $myIE_Obj.document.body.scroll = "no" $myIE_Obj.document.body.style.borderColor = "#000000" Return $myIE_Obj EndFunc ;==>MyWMPlayer When run in v3.3.16.0, an error occurs. The following is SciTE output: "C:\Users\CYCho\OneDrive\zPlayer\IECreateEmbedded_Test1.au3" (16) : ==> The requested action with this object has failed.: If $oPlayer.playState <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit If $oPlayer^ ERROR Just out of curiosity, I changed line 24 to _IENavigate($myIE_Obj, "www.autoitscript.com") and it runs without an outright error in both versions of AutoIt though it takes some time for loading autoitscript.com web page and v3.3.16.0 produces unwanted vertical and horizontal scrollbars in the window. Spoiler #include <GuiConstants.au3> #include <IE.au3> Global $videoWidth = 800, $videoHeight = 450 Global $videoGUI = GUICreate("Video Control", $videoWidth, $videoHeight, 0, 0, $WS_OVERLAPPEDWINDOW) GUISetState() Global $IEControl Global $oIE = MyWMPlayer() Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") $oPlayer.Settings.autoStart = True $oPlayer.URL = "FileFullPath.mp4" Sleep(3000) While 1 $guiMsg = GUIGetMsg() If $oPlayer.playState <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit WEnd Func MyWMPlayer() ; create an IE-embedded WMP object Local $myIE_Obj = _IECreateEmbedded () $IEControl = GUICtrlCreateObj($myIE_Obj, 0, 0, $videoWidth, $videoHeight) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ; 1 _IENavigate($myIE_Obj, "www.autoitscript.com") Local $htmlWMP = '' _ & @CR & '<body style="margin:0; padding:0">' _ & @CR & '<OBJECT ' _ & @CR & 'ID="objWMPlayer"' _ & @CR & 'WIDTH="' & $videoWidth & '"' _ & @CR & 'HEIGHT="' & $videoHeight & '"' _ & @CR & 'CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"' _ & @CR & 'TYPE="application/x-ms-wmp">' _ & @CR & '<PARAM NAME="enableContextMenu" VALUE="true">' _ & @CR & '<PARAM NAME="enableFullScreenControls" VALUE="true">' _ & @CR & '<PARAM NAME="stretchToFit" VALUE="true">' _ & @CR & '</OBJECT>' _ & @CR & '</body>' _IEDocWriteHTML ($myIE_Obj, $htmlWMP) _IEAction ($myIE_Obj, "refresh") $myIE_Obj.document.body.scroll = "no" $myIE_Obj.document.body.style.borderColor = "#000000" Return $myIE_Obj EndFunc ;==>MyWMPlayer @pixelsearch found a cure for this behaviour, which he says was a pure luck: If we change line 39 to _IEAction ($myIE_Obj, "scrollintoview"), it works perfectly in both versions of AutoIt, even without changing line 24. Spoiler #include <GuiConstants.au3> #include <IE.au3> Global $videoWidth = 800, $videoHeight = 450 Global $videoGUI = GUICreate("Video Control", $videoWidth, $videoHeight, 0, 0, $WS_OVERLAPPEDWINDOW) GUISetState() Global $IEControl Global $oIE = MyWMPlayer() Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") $oPlayer.Settings.autoStart = True $oPlayer.URL = "FileFullPath.mp4" Sleep(3000) While 1 $guiMsg = GUIGetMsg() If $oPlayer.playState <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit WEnd Func MyWMPlayer() ; create an IE-embedded WMP object Local $myIE_Obj = _IECreateEmbedded () $IEControl = GUICtrlCreateObj($myIE_Obj, 0, 0, $videoWidth, $videoHeight) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) _IENavigate($myIE_Obj, "about:blank") Local $htmlWMP = '' _ & @CR & '<body style="margin:0; padding:0">' _ & @CR & '<OBJECT ' _ & @CR & 'ID="objWMPlayer"' _ & @CR & 'WIDTH="' & $videoWidth & '"' _ & @CR & 'HEIGHT="' & $videoHeight & '"' _ & @CR & 'CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"' _ & @CR & 'TYPE="application/x-ms-wmp">' _ & @CR & '<PARAM NAME="enableContextMenu" VALUE="true">' _ & @CR & '<PARAM NAME="enableFullScreenControls" VALUE="true">' _ & @CR & '<PARAM NAME="stretchToFit" VALUE="true">' _ & @CR & '</OBJECT>' _ & @CR & '</body>' _IEDocWriteHTML ($myIE_Obj, $htmlWMP) _IEAction ($myIE_Obj, "scrollintoview") $myIE_Obj.document.body.scroll = "no" $myIE_Obj.document.body.style.borderColor = "#000000" Return $myIE_Obj EndFunc ;==>MyWMPlayer So I found a solution, but I would hope to understand what makes this difference between v3.3.14.5 and v3.3.16.0. @pixelsearchand I found that IE.au3 UDF in both versions were the same. Could someone enlighten me? My experience here is based on Windows 10. If anyone tested this in Windows 11, could you share the result in this forum? Edited March 15, 2022 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
ad777 Posted March 14, 2022 Share Posted March 14, 2022 @CYCho you say's:When run in v3.3.16.0, an error occurs. just use Execute Function: Local $OPExe = Execute('$oPlayer.PlayState') If $OPExe <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit iam ِAutoit programmer. best thing in life is to use your Brain to Achieve everything you want. Link to comment Share on other sites More sharing options...
mLipok Posted March 14, 2022 Share Posted March 14, 2022 I check your script with this modified testing script: expandcollapse popup;~ https://www.autoitscript.com/forum/topic/207732-behaviour-of-embedded-windows-media-player-autoit-v33145-vs-v33160/ ;~ #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_14_5" #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_15_1" ;~ #AutoIt3Wrapper_AutoIt3Dir="z:\AutoItPortable\AutoIt_3_3_15_5_beta" #include <GuiConstants.au3> #include <IE.au3> Global $videoWidth = 800, $videoHeight = 450 Global $IEControl _Example() Func _Example() ; Error monitoring. This will trap all COM errors while alive. ; This particular object is declared as local, meaning after the function returns it will not exist. Local $oErrorHandler = ObjEvent("AutoIt.Error", "_ErrFunc") Local $videoGUI = GUICreate("Video Control", $videoWidth, $videoHeight, 0, 0, $WS_OVERLAPPEDWINDOW) GUISetState() Local $oIE = MyWMPlayer() Local $oPlayer = _IEGetObjById($oIE, "objWMPlayer") ObjName_FlagsValue($oPlayer) $oPlayer.Settings.autoStart = True $oPlayer.URL = "FileFullPath.mp4" Sleep(3000) Local $guiMsg While 1 $guiMsg = GUIGetMsg() If $oPlayer.playState <> 3 Or $guiMsg = $GUI_EVENT_CLOSE Then Exit WEnd #forceref $oErrorHandler, $videoGUI EndFunc ;==>_Example Func MyWMPlayer() ; create an IE-embedded WMP object Local $myIE_Obj = _IECreateEmbedded() $IEControl = GUICtrlCreateObj($myIE_Obj, 0, 0, $videoWidth, $videoHeight) GUICtrlSetResizing(-1, $GUI_DOCKAUTO) ; 1 _IENavigate($myIE_Obj, "about:blank") Local $htmlWMP = '' _ & @CR & '<body style="margin:0; padding:0">' _ & @CR & '<OBJECT ' _ & @CR & 'ID="objWMPlayer"' _ & @CR & 'WIDTH="' & $videoWidth & '"' _ & @CR & 'HEIGHT="' & $videoHeight & '"' _ & @CR & 'CLASSID="clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6"' _ & @CR & 'TYPE="application/x-ms-wmp">' _ & @CR & '<PARAM NAME="enableContextMenu" VALUE="true">' _ & @CR & '<PARAM NAME="enableFullScreenControls" VALUE="true">' _ & @CR & '<PARAM NAME="stretchToFit" VALUE="true">' _ & @CR & '</OBJECT>' _ & @CR & '</body>' _IEDocWriteHTML($myIE_Obj, $htmlWMP) _IEAction($myIE_Obj, "refresh") $myIE_Obj.document.body.scroll = "no" $myIE_Obj.document.body.style.borderColor = "#000000" Return $myIE_Obj EndFunc ;==>MyWMPlayer ; User's COM error function. Will be called if COM error occurs Func _ErrFunc($oError) ; Do anything here. ConsoleWrite(@ScriptName & " (" & $oError.scriptline & ") : ==> COM Error intercepted !" & @CRLF & _ @TAB & "err.number is: " & @TAB & @TAB & "0x" & Hex($oError.number) & @CRLF & _ @TAB & "err.windescription:" & @TAB & $oError.windescription & @CRLF & _ @TAB & "err.description is: " & @TAB & $oError.description & @CRLF & _ @TAB & "err.source is: " & @TAB & @TAB & $oError.source & @CRLF & _ @TAB & "err.helpfile is: " & @TAB & $oError.helpfile & @CRLF & _ @TAB & "err.helpcontext is: " & @TAB & $oError.helpcontext & @CRLF & _ @TAB & "err.lastdllerror is: " & @TAB & $oError.lastdllerror & @CRLF & _ @TAB & "err.scriptline is: " & @TAB & $oError.scriptline & @CRLF & _ @TAB & "err.retcode is: " & @TAB & "0x" & Hex($oError.retcode) & @CRLF & @CRLF) EndFunc ;==>_ErrFunc Func ObjName_FlagsValue(ByRef $oObj) Local $sInfo = '' $sInfo &= '+>' & @TAB & 'ObjName($oObj,1) {The name of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_NAME) & @CRLF ; HELPFILE REMARKS: Not all Objects support flags 2 to 7. Always test for @error in these cases. $sInfo &= '+>' & @TAB & 'ObjName($oObj,2) {Description string of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_STRING) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,3) {The ProgID of the Object} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_PROGID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,4) {The file that is associated with the object in the Registry} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_FILE) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,5) {Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_MODULE) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,6) {CLSID of the object''s coclass} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_CLSID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF $sInfo &= '+>' & @TAB & 'ObjName($oObj,7) {IID of the object''s interface} =' & @CRLF & @TAB & ObjName($oObj, $OBJ_IID) If @error Then $sInfo &= '@error = ' & @error $sInfo &= @CRLF & @CRLF ConsoleWrite($sInfo & @CRLF) EndFunc ;==>ObjName_FlagsValue And I get: Quote +> ObjName($oObj,1) {The name of the Object} = HTMLObjectElement +> ObjName($oObj,2) {Description string of the Object} = +> ObjName($oObj,3) {The ProgID of the Object} = @error = 1 +> ObjName($oObj,4) {The file that is associated with the object in the Registry} = C:\Windows\System32\mshtml.tlb +> ObjName($oObj,5) {Module name in which the object runs (WIN XP And above). Marshaller for non-inproc objects.} = C:\Windows\System32\mshtml.dll +> ObjName($oObj,6) {CLSID of the object's coclass} = {3050F24E-98B5-11CF-BB82-00AA00BDCE0B} +> ObjName($oObj,7) {IID of the object's interface} = {3050F529-98B5-11CF-BB82-00AA00BDCE0B} Au3.3.16.0__WMP.au3 (31) : ==> COM Error intercepted ! err.number is: 0x80070005 err.windescription: Odmowa dostępu err.description is: err.source is: err.helpfile is: err.helpcontext is: err.lastdllerror is: 0 err.scriptline is: 31 err.retcode is: 0x00000000 +>09:40:17 AutoIt3.exe ended.rc:0 +>09:40:17 AutoIt3Wrapper Finished. >Exit code: 0 Time: 4.784 Access denied. It looks that this problem araised on Au3.3.15.1 beta. Signature beginning:* Please remember: "AutoIt"..... * Wondering who uses AutoIt and what it can be used for ? * Forum Rules ** ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Code * for other useful stuff click the following button: Spoiler Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind. My contribution (my own projects): * Debenu Quick PDF Library - UDF * Debenu PDF Viewer SDK - UDF * Acrobat Reader - ActiveX Viewer * UDF for PDFCreator v1.x.x * XZip - UDF * AppCompatFlags UDF * CrowdinAPI UDF * _WinMergeCompare2Files() * _JavaExceptionAdd() * _IsBeta() * Writing DPI Awareness App - workaround * _AutoIt_RequiredVersion() * Chilkatsoft.au3 UDF * TeamViewer.au3 UDF * JavaManagement UDF * VIES over SOAP * WinSCP UDF * GHAPI UDF - modest begining - comunication with GitHub REST API * ErrorLog.au3 UDF - A logging Library * Include Dependency Tree (Tool for analyzing script relations) * Show_Macro_Values.au3 * My contribution to others projects or UDF based on others projects: * _sql.au3 UDF * POP3.au3 UDF * RTF Printer - UDF * XML.au3 UDF * ADO.au3 UDF * SMTP Mailer UDF * Dual Monitor resolution detection * * 2GUI on Dual Monitor System * _SciLexer.au3 UDF * SciTE - Lexer for console pane * Useful links: * Forum Rules * Forum etiquette * Forum Information and FAQs * How to post code on the forum * AutoIt Online Documentation * AutoIt Online Beta Documentation * SciTE4AutoIt3 getting started * Convert text blocks to AutoIt code * Games made in Autoit * Programming related sites * Polish AutoIt Tutorial * DllCall Code Generator * Wiki: * Expand your knowledge - AutoIt Wiki * Collection of User Defined Functions * How to use HelpFile * Good coding practices in AutoIt * OpenOffice/LibreOffice/XLS Related: WriterDemo.au3 * XLS/MDB from scratch with ADOX IE Related: * How to use IE.au3 UDF with AutoIt v3.3.14.x * Why isn't Autoit able to click a Javascript Dialog? * Clicking javascript button with no ID * IE document >> save as MHT file * IETab Switcher (by LarsJ ) * HTML Entities * _IEquerySelectorAll() (by uncommon) * IE in TaskScheduler * IE Embedded Control Versioning (use IE9+ and HTML5 in a GUI) * PDF Related: * How to get reference to PDF object embeded in IE * IE on Windows 11 * I encourage you to read: * Global Vars * Best Coding Practices * Please explain code used in Help file for several File functions * OOP-like approach in AutoIt * UDF-Spec Questions * EXAMPLE: How To Catch ConsoleWrite() output to a file or to CMD *I also encourage you to check awesome @trancexx code: * Create COM objects from modules without any demand on user to register anything. * Another COM object registering stuff * OnHungApp handler * Avoid "AutoIt Error" message box in unknown errors * HTML editor * winhttp.au3 related : * https://www.autoitscript.com/forum/topic/206771-winhttpau3-download-problem-youre-speaking-plain-http-to-an-ssl-enabled-server-port/ "Homo sum; humani nil a me alienum puto" - Publius Terentius Afer"Program are meant to be read by humans and only incidentally for computers and execute" - Donald Knuth, "The Art of Computer Programming" , be and \\//_. Anticipating Errors : "Any program that accepts data from a user must include code to validate that data before sending it to the data store. You cannot rely on the data store, ...., or even your programming language to notify you of problems. You must check every byte entered by your users, making sure that data is the correct type for its field and that required fields are not empty." Signature last update: 2023-04-24 Link to comment Share on other sites More sharing options...
pixelsearch Posted March 14, 2022 Share Posted March 14, 2022 (edited) Hi everybody, This is becoming more complicated, each digging brings back more mud.@CYCho : let's resume (again) the different steps we've been through since yesterday : 1) With line : _IEAction ($myIE_Obj, "refresh") It worked with AutoIt 3.3.14.5, it doesn't work with 3.3.16.0, fatal console error being : While $oPlayer.playState <> $iPlaying While $oPlayer^ ERROR 2) Instead, with this line : _IEAction ($myIE_Obj, "scrollintoview") It seems to work fine in 3.3.16.0, that's how you scripted the new version of zPlayer 3.0.2.5 and put it online a few hours ago. 3) Unfortunately, though it apparently works, it didn't really solve the issue if we look at AutoIt Console : --> IE.au3 V3.1-0 Error from function _IEAction(scrollintoview), $_IESTATUS_InvalidObjectType It's a warning message, non fatal, while an audio file or a video file plays correctly (without scrollbars for the video) 4) Time to paste a part of 2 functions found in IE.au3 A part of _IEAction() : ... Case $sAction = "scrollintoview" If __IEIsObjType($oObject, "documentContainer") Then __IEConsoleWriteError("Error", "_IEAction(scrollintoview)", "$_IESTATUS_InvalidObjectType") Return SetError($_IESTATUS_InvalidObjectType, 1, 0) EndIf $oObject.scrollIntoView() ... Case $sAction = "refresh" $oObject.document.execCommand("Refresh") If @error Then ; Trap COM error, report and return __IEConsoleWriteError("Error", "_IEAction(refresh)", "$_IESTATUS_COMError", @error) Return SetError($_IESTATUS_ComError, @error, 0) EndIf _IELoadWait($oObject) ... Now a part of function _IELoadWait(), which is the last line of the "refresh" part as you can see just above : Func _IELoadWait(ByRef $oObject, $iDelay = 0, $iTimeout = -1) ... Sleep($iDelay) ... EndFunc 5) The patch in 2) "scrollintoview" doesn't really fix things because when its error appears in the console, then the function returns without executing its last line $oObject.scrollIntoView() ... which would have returned an error too ! So in fact, you can comment both lines and the script still works fine : ; _IEAction ($myIE_Obj, "refresh") ; _IEAction ($myIE_Obj, "scrollintoview") 6) Let's go back to this last line _IELoadWait($oObject) found in Case $sAction = "refresh" I find it strange that there isn't a 2nd argument passed when calling the function (the delay argument). As soon as I alter the call like this in the include function : _IELoadWait($oObject, 10) ; "10 Milliseconds to wait before checking status" Then _IEAction ($myIE_Obj, "refresh") works fine again in 3.3.16.0, with a simple delay of 10ms ! 7) If devs think this is the reason of this malfunction, I suggest this change in _IEAction() because it doesn't seem normal that the user can't force any delay during his call : * Add a 3rd optional parameter to the function : ; Func _IEAction(ByRef $oObject, $sAction) Func _IEAction(ByRef $oObject, $sAction, $iDelay = 0) * Modify this line in the function, allowing the user to call _IELoadWait() action with a delay : Case $sAction = "refresh" ... ; _IELoadWait($oObject) _IELoadWait($oObject, $iDelay) * If this is done (Cycho) now you could call the function like this, from your script : ; _IEAction ($myIE_Obj, "refresh") _IEAction ($myIE_Obj, "refresh", 10) ; "10 Milliseconds to wait before checking status" If 10ms isn't enough, then you could increase it to 20, 50 etc... (it worked with 10 on my antique computer !) Well it was a long post but I think it was worthwhile to share these new tests, maybe someone may have additional ideas about that 8) Edit: or, without altering the include file, you could add the delay line directly in your script, it seems to work too... though solution 7) seems better : no need to call _IELoadWait() twice when you can call it only once : _IEAction ($myIE_Obj, "refresh") _IELoadWait($myIE_Obj, 10) ; <====== added line Edited March 14, 2022 by pixelsearch added 8) Musashi and CYCho 2 Link to comment Share on other sites More sharing options...
CYCho Posted March 14, 2022 Author Share Posted March 14, 2022 (edited) @pixelsearch, I like the magnifying glass on your avatar. I basically borrowed the function from an old post in this forum and I didn't have to scrutinize it because it worked. Now I tested, by way of adding some text in $htmlWMP, and know that _IEAction ($myIE_Obj, "refresh") is redundant. Even though the question remains to be answered, I will delete the line from my code and consider my problem solved. Thank you and keep up with the good work. You have a lot of sense in having $iDelay option in _IEAction(). I hope the developers will buy your idea. Edited March 14, 2022 by CYCho pixelsearch 1 zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
Nine Posted March 14, 2022 Share Posted March 14, 2022 (edited) Well that is a really "interesting" issue. Just adding a small Sleep(10), instead of _IELoadWait($myIE_Obj, 10), solves also the problem. That is very odd, especially since there is a big Sleep(3000) just before starting the While...WEnd loop. Even if you put 4000-5000 it is still crashing with an Access Denied error (0x80070005). If you check the validity of the object : _IEAction ($myIE_Obj, "refresh") ConsoleWrite(ObjName($myIE_Obj) & "/" & __IEIsObjType($myIE_Obj, "browser", False) & "/" & _ $myIE_Obj.readyState & "/" & $myIE_Obj.document.readyState & @CRLF) $myIE_Obj.document.body.scroll = "no" $myIE_Obj.document.body.style.borderColor = "#000000" You can see that it is all perfectly loaded and ready. The next 2 property sets (after refresh) proves that the object is well created as it doesn't crash the script. So there is absolutely no need to add a delay there. Now if you add a Sleep(10) just between the 2 functions that create the objects it solves the issue. Global $oIE = MyWMPlayer() ConsoleWrite(ObjName($oIE) & @CRLF) Sleep(10) Global $oPlayer = _IEGetObjById($oIE, "objWMPlayer") ConsoleWrite(ObjName($oPlayer) & @CRLF) So the real question, why a simple sleep of 10ms suddenly makes the object more "usable". In fact, the true real question, what is the difference between 3.3.14.5 and the newer versions that could impact the object accessibility. Edit : if you push the GUISetState() after the $oIE object creation, you do not need any Sleep at all. It is probably due to the delay caused by the display of the Windows GUI. If you push further the GUISetState after the big sleep the issue reappears. My take there is a bug created after version 3.3.14.5 and it should be reported. Edited March 14, 2022 by Nine CYCho 1 “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Screen Scraping Multi-Threading Made Easy Link to comment Share on other sites More sharing options...
CYCho Posted March 15, 2022 Author Share Posted March 15, 2022 (edited) @Nine, thank you for trying this out. I tried inserting Sleep(10) and movinfgGUISetSte(). They apparently work and it means that $oPlayer object was successfuly created. But $oPlayer seems to have failed to load $myIE_Obj.document.body.scroll = "no" property and produces vertical and horizontal scrollbars in both of the cases. For me, I can do away with _IEAction ($myIE_Obj, "refresh"), but this certainly requires to be addressed. Edited March 15, 2022 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment Link to comment Share on other sites More sharing options...
CYCho Posted March 15, 2022 Author Share Posted March 15, 2022 (edited) I found that a sleep of 10 milliseconds after _IEAction ($myIE_Obj, "refresh") is also a cure for this problem. This supports @pixelsearch's proposal to add $iDelay as the 3rd parameter of _IEAction() which then can be passed to _IELoadWait(). _IEAction ($myIE_Obj, "refresh") Sleep(10) $myIE_Obj.document.body.scroll = "no" Edited March 15, 2022 by CYCho zPlayer - A Small Audio and Video Player Time Sync + SystemTimeAdjustment 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