gooker Posted August 7, 2008 Share Posted August 7, 2008 i want to get the height/width of one frame, so i search the formand here is a good example for input,and it work very well: http://www.autoitscript.com/forum/index.ph...p;hl=offsetLeftbut when i use _IE_Example ("iframe") to get one iframe's height, i get error :$curleft += $Parent.offsetLeft^ ERRORexpandcollapse popup#include <IE.au3> _IEErrorHandlerRegister ("MyErrFunc") $oIE =_IE_Example ("iframe") $iFrame = _IEFrameGetObjByName ($oIE, "iFrameOne") MsgBox(0, "Frame Info",_IEfindPosX($iFrame)) MsgBox(0, "Frame Info",$iFrame.height) _IEQuit($oIE) func _IEfindPosX($o_object) local $curleft = 0 local $parent = $o_object if IsObj($parent) then while IsObj($parent) $curleft += $Parent.offsetLeft $parent = $Parent.offsetParent wend else local $objx = $o_object.x if IsObj($objx) then $curleft += $objx EndIf return $curleft EndFunc Func MyErrFunc() ; Important: the error object variable MUST be named $oIEErrorHandler $ErrorScriptline = $oIEErrorHandler.scriptline $ErrorNumber = $oIEErrorHandler.number $ErrorNumberHex = Hex($oIEErrorHandler.number, 8) $ErrorDescription = StringStripWS($oIEErrorHandler.description, 2) $ErrorWinDescription = StringStripWS($oIEErrorHandler.WinDescription, 2) $ErrorSource = $oIEErrorHandler.Source $ErrorHelpFile = $oIEErrorHandler.HelpFile $ErrorHelpContext = $oIEErrorHandler.HelpContext $ErrorLastDllError = $oIEErrorHandler.LastDllError $ErrorOutput = "" $ErrorOutput &= "--> COM Error Encountered in " & @ScriptName & @CR $ErrorOutput &= "----> $ErrorScriptline = " & $ErrorScriptline & @CR $ErrorOutput &= "----> $ErrorNumberHex = " & $ErrorNumberHex & @CR $ErrorOutput &= "----> $ErrorNumber = " & $ErrorNumber & @CR $ErrorOutput &= "----> $ErrorWinDescription = " & $ErrorWinDescription & @CR $ErrorOutput &= "----> $ErrorDescription = " & $ErrorDescription & @CR $ErrorOutput &= "----> $ErrorSource = " & $ErrorSource & @CR $ErrorOutput &= "----> $ErrorHelpFile = " & $ErrorHelpFile & @CR $ErrorOutput &= "----> $ErrorHelpContext = " & $ErrorHelpContext & @CR $ErrorOutput &= "----> $ErrorLastDllError = " & $ErrorLastDllError MsgBox(0,"COM Error", $ErrorOutput) SetError(1) Return EndFunc ;==>MyErrFunc Link to comment Share on other sites More sharing options...
gooker Posted August 7, 2008 Author Share Posted August 7, 2008 i know what's wrong the answer: $oInput.document.parentwindow.frames.length Link to comment Share on other sites More sharing options...
gooker Posted August 7, 2008 Author Share Posted August 7, 2008 another problem, call a javascript function in a iframe,like : $oFrame.document.parentwindow.execScript("chatSub()","javascript") fail,iframe's problem? Link to comment Share on other sites More sharing options...
DaleHohm Posted August 7, 2008 Share Posted August 7, 2008 i know what's wrong the answer: $oInput.document.parentwindow.frames.lengthframes.length shows you the number of frames (the length of the frame array), not the dimensions. Your basic trouble is understanding that there is a an iFrame tag and an iFrame as a window. To get the dimentions, you need the tag... try this: #include <IE.au3> $oIE = _IE_Example("iFrame") $oFrame = _IETagnameGetCollection($oIE, "iframe", 0) ConsoleWrite(_IEPropertyGet($oFrame, "height") & @CRLF) regarding your $oFrame.document.parentwindow.execScript("chatSub()","javascript") try something simple first like ("var x = 7; alert(x)") Dale P.S. please DO NOT PM me to alert me to your topics in the forum. Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe 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 Link to comment Share on other sites More sharing options...
gooker Posted August 7, 2008 Author Share Posted August 7, 2008 ths,that's great,can you tell me your msn? #include <IE.au3> $oIE =_IE_Example ("iframe") $iFrame = _IEFrameGetObjByName ($oIE, "iFrameOne") $oFrame = _IEGetObjByName ($oIE, "iFrameOne") tthe last question : the difference of $iFrame and $oFrame? Link to comment Share on other sites More sharing options...
DaleHohm Posted August 7, 2008 Share Posted August 7, 2008 (edited) ths,that's great,can you tell me your msn? Absolutely not. I think you could be a real pain in the ass. #include <IE.au3> $oIE =_IE_Example ("iframe") $iFrame = _IEFrameGetObjByName ($oIE, "iFrameOne") $oFrame = _IEGetObjByName ($oIE, "iFrameOne") tthe last question : the difference of $iFrame and $oFrame?One returns a window, the other a frame element (tag). Use ObjName() Dale Edited August 7, 2008 by DaleHohm Free Internet Tools: DebugBar, AutoIt IE Builder, HTTP UDF, MODIV2, IE Developer Toolbar, IEDocMon, Fiddler, HTML Validator, WGet, curl MSDN docs: InternetExplorer Object, Document Object, Overviews and Tutorials, DHTML Objects, DHTML Events, WinHttpRequest, XmlHttpRequest, Cross-Frame Scripting, Office object model Automate input type=file (Related) Alternative to _IECreateEmbedded? better: _IECreatePseudoEmbedded Better Better? IE.au3 issues with Vista - Workarounds SciTe 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 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