Sign in to follow this  
Followers 0
gooker

Need Help with iframe,autoit bug?

6 posts in this topic

i want to get the height/width of one frame, so i search the form

and here is a good example for input,and it work very well: http://www.autoitscript.com/forum/index.ph...p;hl=offsetLeft

but when i use _IE_Example ("iframe") to get one iframe's height,

i get error :$curleft += $Parent.offsetLeft^ ERROR

#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

Share this post


Link to post
Share on other sites



i know what's wrong

:P

the answer:

$oInput.document.parentwindow.frames.length


Share this post


Link to post
Share on other sites

another problem,

call a javascript function in a iframe,like :

$oFrame.document.parentwindow.execScript("chatSub()","javascript")

fail,iframe's problem?


Share this post


Link to post
Share on other sites

i know what's wrong

:P

the answer:

$oInput.document.parentwindow.frames.length

frames.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

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

:P

ths,that's great,can you tell me your msn? :P

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 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

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0