Jump to content
Sign in to follow this  
Oldschool

_IEAttach

Recommended Posts

Oldschool

I'm trying to attach to an overlay that has the following source...

<HTML>
 <HEAD>
  <TITLE>Overlay</TITLE>
  <script LANGUAGE="Javascript">
   function AlignElementContent(element)
   {
    var width = element.getBoundingClientRect().right - element.getBoundingClientRect().left;
    if(element.ALIGNX != null)
    {
     if(new Number(element.ALIGNX) - width / 2 >= 0 && new Number(element.ALIGNX) + width / 2 <= element.parentElement.clientWidth)
     {
      element.style.left = new Number(element.ALIGNX) - width / 2;
     }
     else
     if(new Number(element.ALIGNX) - width / 2 >= 0)
     {
      element.style.left = element.parentElement.clientWidth - width;
     }
     else
     {
      element.style.left = 0;
     }
    }
    if(element.ALIGNY != null)
    {
    }
   }
   function AlignElementsContent()
   {
    var items = document.all["CONTENT"];
    if(items != null)
    {
     if(items.length != null)
     {
      for(var i = items.length - 1; i >= 0; i--)
      {
       AlignElementContent(items[i]);
      }
     }
     else
     {
      AlignElementContent(items);
     }
    }
   }
  </SCRIPT>
 </HEAD>
 <BODY SCROLL="no" BGCOLOR="#008080">
  <DIV ID="CLIENTAREA" STYLE="position:absolute;left:3px;top:29px;width:800px;height:600px;">
   <DIV STYLE="position:relative;background-color:transparent;left:329px;top:310px;width:140px;height:40px;visibility:visible;overflow:hidden;">
    <TABLE WIDTH="100%" HEIGHT="100%" BORDER="0" CELLSPACING="0" CELLPADDING="0">
     <TBODY>
      <TR>
       <TD>
        <SPAN ID="CONTENT" CONTENTID="AddInfo" TRANSFORMATION="Add.xsl" ALIGNX="67" STYLE="font-family:Tahoma;font-size:24pt;font-weight:700;font-style:normal;color:#000000;position:relative;" SETTINGSITEMNAME="AddInfo" SETTINGSGROUPNAME="AddInfo">
        </SPAN>
       </TD>
      </TR>
     </TBODY>
    </TABLE>
   </DIV>
  </DIV>
 </BODY>
</HTML>

using this:

$s_string = "Overlay"
$oIE = _IEAttach($s_string , "Title") 
$oDiv = _IEGetObjById ($oIE, "AddInfo")
MsgBox(0, "", _IEPropertyGet($oDiv, "innertext") & @CR)

And getting 0 in the MsgBox & this in SciTe:

--> IE.au3 V2.3-1 Warning from function _IEAttach, $_IEStatus_NoMatch
--> IE.au3 V2.3-1 Error from function _IEGetObjById, $_IEStatus_InvalidDataType
--> IE.au3 V2.3-1 Error from function _IEPropertyGet, $_IEStatus_InvalidDataType

Another question I have is how do I go about getting this Overlays HWND, and how do I go about getting a list of all open _IE objects??

Share this post


Link to post
Share on other sites
Oldschool

Well, I managed to get the HWND and attach to where I need to....yippeeeee

#include <IE.au3>

MouseClick("left", 560, 885)
$Title = WinGetTitle("")
$hWND = WinGetHandle($Title, "")
MsgBox(0, "", $Title & Chr(44) & $hWND)
$oIE = _IEAttach($hWND , "Embedded")

Now I just need to read of the elements....I guess I should be doing something like:

$oForm = _IEFormGetCollection ($oIE, 0)

How can I see those???

MsgBox(0,"", $oForm)

??

Share this post


Link to post
Share on other sites
DaleHohm

$oForm will be a special variant called an object. You can display it in a MsgBox, but it will not be useful or recognizable text. Object have "properties" and "methods"... IE.au3 gives you simplified access to many of these, but doesn't replace the necessity to have a basic understanding of them if you want to do anything more than the basics.

Suggestions: 1) work through the _IE* examples in the helpfile -- don't just read them, execute them and modify them, 2) download, install and learn to use DebugBar (see my sig) to take the mystery out of the document object model (DOM) 3) read through the Obj/COM section in the helpfile and then 4) come back to the forum with specific questions and code then get you through knotholes and move to the next level.

Dale


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  

×