Damein 19 Posted November 23, 2011 Alright, so I am trying to embed a frame into a GUI and then read that frame. This is the code I have made. expandcollapse popup#include <EditConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <IE.au3> #include <INet.au3> $oIE = _IECreateEmbedded() $Form1 = GUICreate("_IEDocWriteHTML Demo", 600, 400) $Obj1 = GUICtrlCreateObj($oIE, 5, 5, 590, 390) _IENavigate($oIE, "about:blank") GUISetState(@SW_SHOW) $Html = '<!-- 1. The <div> tag will contain the <iframe> (and video player) -->' & _ '<div id="player"></div>' & _ '<script>' & _ 'var tag = document.createElement("script");' & _ 'tag.src = "http://www.youtube.com/player_api";' & _ 'var firstScriptTag = document.getElementsByTagName("script")[0];' & _ 'firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);' & _ 'var player;' & _ 'function onYouTubePlayerAPIReady() {' & _ 'player = new YT.Player("player", {' & _ 'height: "390",' & _ 'width: "640",' & _ 'videoId: "u1zgFlCw8Aw",' & _ 'events: {' & _ '"onReady": onPlayerReady,' & _ '"onStateChange": onPlayerStateChange' & _ '}' & _ '});' & _ '}' & _ 'function onPlayerReady(event) {' & _ 'event.target.playVideo();' & _ '}' & _ 'var done = false;' & _ 'function onPlayerStateChange(event) {' & _ 'if (event.data == YT.PlayerState.PLAYING && !done) {' & _ 'setTimeout(stopVideo, 6000);' & _ 'done = true;' & _ '}' & _ '}' & _ 'function stopVideo() {' & _ 'player.stopVideo();' & _ '}' & _ '</script>' SplashTextOn(@ScriptDir, "Please wait", 200, 50) _IEDocWriteHTML($oIE, $Html) _IEAction($oIE, "refresh") SplashOff() Sleep(3000) $oFrames = _IEFrameGetCollection ($oIE) $iNumFrames = @extended If $iNumFrames > 0 Then If _IEIsFrameSet ($oIE) Then MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " frames in a FrameSet") Else MsgBox(0, "Frame Info", "Page contains " & $iNumFrames & " iFrames") EndIf Else MsgBox(0, "Frame Info", "Page contains no frames") EndIf While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd So that says there is 1 frame on the GUI. I've never messed with a lot of HTML so I'm not 100% but I assume the frames name is "player". So I tried this: $oFrame = _IEFrameGetObjByName ($oIE, "player") MsgBox(0, "Test", $oFrame) Instead and I get a invalid object message. Most recent sig. I madeQuick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Share this post Link to post Share on other sites
Damein 19 Posted November 23, 2011 I think I'm getting close to what I want, but not sure. I stumbled across the function HeadInsertEvent and it seems like I should be able to call it from here, but I can't get it to work. I tried adding this _IEHeadInsertEventScript($oIE, "player", "onStateChange", "alert('Changed!');") But to no avail Most recent sig. I madeQuick Launcher W/ Profiles Topic Movie Database Topic & Website | LiveStreamer Pro Website | YouTube Stand-Alone Playlist Manager: Topic | Weather Desktop Widget: Topic | Flash Memory Game: Topic | Volume Control With Mouse / iTunes Hotkeys: Topic | Weather program: Topic | Paws & Tales radio drama podcast mini-player: Topic | Quick Math Calculations: Topic Share this post Link to post Share on other sites
DaleHohm 65 Posted December 1, 2011 player is the id of your DIV... is that what you want? Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curlMSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object modelAutomate input type=file (Related)Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better?IE.au3 issues with Vista - WorkaroundsSciTe Debug mode - it's magic: #AutoIt3Wrapper_run_debug_mode=Y Doesn't work needs to be ripped out of the troubleshooting lexicon. It means that what you tried did not produce the results you expected. It begs the questions 1) what did you try?, 2) what did you expect? and 3) what happened instead?Reproducer: a small (the smallest?) piece of stand-alone code that demonstrates your trouble Share this post Link to post Share on other sites