Jump to content
Sign in to follow this  
jayyx

Loop through _IEFrameGetCollection looking for _IEFormGetObjByName

Recommended Posts

I will start by saying I'm no expert and my code is sloppy. However, I was able to accomplish what I needed. Here is my problem...

;Local $oFrame = _IEFrameGetCollection($oIE, 1)
;Local $oForm = _IEFormGetObjByName($oFrame, "DlgAddWorkspace")

That code works to grab my objects on one system, but on another system the frame index number changes -- so it can not successfully grab the $oForm object. I have been trying to figure out the best way to loop through the entire _IEFrameGetCollection looking for the Form 'DlgAddWorkspace' but I have not been able to do so thus far. I need a little guidance or the best approach for this.

This doesn't work but I tried something along the lines of a loop within a loop:

Do
Local $oFrames = _IEFrameGetCollection($oIE)
Local $iNumFrames = @extended
For $i = 0 To ($iNumFrames - 1)
    Local $oFrame = _IEFrameGetCollection($oIE, $i)
    Local $oForm = _IEFormGetObjByName($oFrame, "DlgAddWorkspace")
Next
If isObj($oForm) Then
$i = $iNumFrames
EndIf
Until isObj($oForm)

Any guidance would be much appreciated. Thanks!

Share this post


Link to post
Share on other sites

I found a method that works but isn't fool proof...any suggestions for improvements would be much appreciated!

$FrameCount = 1
Local $oFrame = _IEFrameGetCollection($oIE, $FrameCount)
Local $oFormCollection = _IEFormGetCollection($oFrame)
If @extended > 0 Then
Local $oForm = _IEGetObjByName($oFrame, "DlgAddWorkspace")
Else
$FrameCount = $FrameCount + 1
Local $oFrame = _IEFrameGetCollection($oIE, $FrameCount)
Local $oFormCollection = _IEFormGetCollection($oFrame)
If @extended > 0 Then
Local $oForm = _IEGetObjByName($oFrame, "DlgAddWorkspace")
Else
$FrameCount = $FrameCount + 1
Local $oFrame = _IEFrameGetCollection($oIE, $FrameCount)
Local $oFormCollection = _IEFormGetCollection($oFrame)
If @extended > 0 Then
Local $oForm = _IEGetObjByName($oFrame, "DlgAddWorkspace")
EndIf
EndIf
EndIf

Share this post


Link to post
Share on other sites

I think I've ended up answering my own question in the end, but will post here for anyone who may have the same problem...

Do
Local $FrameCount = $framecount + 1
Local $oFrame = _IEFrameGetCollection($oIE, $FrameCount)
Sleep(200)
Local $oForm = _IEFormGetObjByName($oFrame, "DlgAddWorkspace")
Sleep(200)
Until isObj ($oForm)

I am still open to suggestions for a better way to go about this..

Edited by jayyx

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...