Jump to content
Sign in to follow this  
biase

Get Height of Internet Explorer top bar [SOLVED]

Recommended Posts

biase

Is there any way to get the top bar height of internet explorer?
Because some Internet Explorer have Menubar and Boomarks and some dont.

I don't know where to start.

get_height.png

Edited by biase

Share this post


Link to post
Share on other sites
biase

bump

Share this post


Link to post
Share on other sites
LarsJ

This can be done with the UI Automation framework.

Download the two UDFs in bottom of first post, and download and run the code in the "Simple spy demo" codebox in the middle of first post.

To verify that a control can be identified place the mouse cursor over the control and press Ctrl+w. You can see an example here.

If you procures information for the bounding rectangle of the title bar and the Google window, you can use the y-values to get the height.

Or you can verify directly, if there is a menu bar.

Note that the framework is based on COM interface objects (created with ObjCreateInterface), so it's not just as easy to use as most built-in commands.

Share this post


Link to post
Share on other sites
biase

i will try it, thank you for the start

Share this post


Link to post
Share on other sites
biase

JohnOne

Thank you for the tips, but the ControlGetPost does not return the height

Share this post


Link to post
Share on other sites
jdelaney

What do you need the height for. You should be able to use the _ie* functions, which work regardless of the size, or number, of toolbars.


IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window.

Share this post


Link to post
Share on other sites
BrewManNH

JohnOne

Thank you for the tips, but the ControlGetPost does not return the height

Yes it does. Unless it's not returning it only for this specific control, this function does return the height

 

Return Value

Success: an array containing the size and the control's position relative to its client window:

    $aArray[0] = X position

    $aArray[1] = Y position

    $aArray[2] = Width

    $aArray[3] = Height <<<<<<<<<<<<<<<<<


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
biase

It does return a value.. here is the code

$cgp = ControlGetPos('[Class:IEFrame]', '', '[CLASS:Internet Explorer_Server; INSTANCE:1]')
ConsoleWrite($cgp[0] & ", " & $cgp[1] & ", " & $cgp[2] & ", " & $cgp[3] & @CRLF)

here is the value from console after the code was executed

0, 67, 1600, 758

I dont think 758 is the height of Internet Explorer top bar.

Edited by biase

Share this post


Link to post
Share on other sites
JohnOne

No but 67 is the height of the title bar plus any other crap you have like address and tool bars or bookmarks.

Whick is exactly what you asked for is it not?

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites
biase

I want to know the Hight of the Top Bar, so I will know the inner html document top position which is below the top bar.

if I do it manually using MouseGetPos the value are 92, which mean the top bar height is 92pixels and the inner html document are at 92 pixel from top

Share this post


Link to post
Share on other sites
BrewManNH

On my computer, there isn't one bar from the top of the screen to the top of the client area. There's the title bar, then the address bar, then tab bar, then the menu bar, then the favorites and tools bar (on the same line). All this adds up so that you'd have to measure each one. Or, using the better method, using the top of the client area as the measurement of the bottom of all those bars added up together.

All that being said, using mouse click positions to click on a web page is probably one of the least effective ways of interacting with a web page, so it should be a moot point as to what the size of the top bars of IE are.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
jguinch

Be carefull, [CLASS:Internet Explorer_Server; INSTANCE:1] does not necessarily correspond to the document-body control. It can also be an addon (toolbar for example).

If you must use the method "click & send", maybe the _IECreateEmbedded function would be better ([CLASS:Internet Explorer_Server; INSTANCE:1] will be the only control).

Now, I think you need to get the document-body coordinates (relative to the screen) to move the mouse, so you can directly use WinGetPos() with the control :

#Include <IE.au3>

$oIE = _IECreate("about:blank")
$hWnd = _IEPropertyGet($oIE, "hwnd")

$aPos = WinGetPos( ControlGetHandle($hWnd, "", "[CLASS:Internet Explorer_Server; INSTANCE:1]") )
MouseMove($aPos[0], $aPOs[1])
Edited by jguinch

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  

  • Similar Content

    • Seminko
      By Seminko
      Wrote a script that grabs all of the IP addresses from Netflix's IP log, checks the IPs and returns suspicious activity.
      Everything works as it should but only when _IECreate is set to visible. When visible is set to false, it fails to login for some reason.
      Any ideas what might cause it and/or how to circumvent that?
    • nooneclose
      By nooneclose
      Hello again, I am in phase two of my help bot. I cannot figure out how to properly code Autoit to click on a webpage button using the I.E UDF. I want to click on the button that I have attached as an image. This button does not have a name but it has an ID. Here is the HTML code for this button that I found using chromes developer inspector.
      HTML Code: 
      <img role="button" tabindex="-1" id="toolactions_INSERT-tbb_image" src="nav_icon_insertkey.gif" alt="New Work Order CTRL+ALT+I" draggable="false"> Here is the code that I have so far:
      ;******************************************************************************* ; Opens IE and fill out a New Workorder ;******************************************************************************* ; Start IE at the ** Tracking Application in ****** $oIE = _IECreate("https:I_am_Bound_by_my_company_to_not_reveal_this_webpage") ; Wait for a browser page load to complete _IELoadWait($oIE) Sleep(6000) ; Store the field names where the important data will be sent Local $nWorkOrderB = _IEGetObjById($oIE, "toolactions_INSERT-tbb_image") _IEAction($nWorkOrderB, "click")  I want my program to click on the button that looks like a piece of paper with a blue # 
      (For those wondering, I am allowed to send images just not the URL.) 
      As always any help would be appreciated. 

    • ohaya
      By ohaya
      Hi,
      I have a situation where I need to make one request to get a kind of pre-logon page, then click a link on that pre-logon page, which then returns a login form page, and then fill in information in the form page and submit it.
      How can I handle that using AutoIT?
      I can get the AutoIT script to tab to the link, then send an ENTER, which then causes the FORM page to appear in IE.  However, I cannot seem to get the form object from the FORM page (_IEFormGetObjByName fails when it searches for the form).  Why is that, and how can I get the AutoIT to process the FORM page?
      Thanks,
      Jim
    • seryth
      By seryth
      I have a script that opens some Excel books that  are stored in SharePoint .  Without getting to much into detail as its a very long story I have to open Internet Explorer to the SP site in order for all of this crap to work. 
       
      Anyway I have a bit of code in my script that i found via google-fu
      $ieList = ProcessList("iexplore.exe") If IsArray($ieList) Then For $I = 1 To Ubound($ieList) -1 ProcessWaitClose($ieList[$I][1]) Next EndIf Exit Now on Windows 7 this bit works great.  On Windows Server 2012 R2 where this things runs is another story.  I need to be able to force close all instances of Internet explorer that are running as part of my code. 
       
      Any help is appreciated. 
    • Joro
      By Joro
      Hi,
      I'm struggeling with the following:
      In a website I have to fill in several items. For the normal fields I am able to fill in the information by using UDF "_IEGetObjByName".
      But there is also a dropdown menu and I can't figure out how to choose te right information from it. I have searched the helpfile and the forum but I can't figure it out.
      Here's an excerpt  from the html-page of the site where the dropdown-menu is mentioned:
      <div class="col-md-10 padding-5">
       <div class="btn-group m-r">
        <input type="hidden" name="bedrijfId" class="bedrijfId" value="">
                  <button type="button" data-toggle="dropdown" class="btn btn-sm btn-default dropdown-toggle" >
                       <span class="dropdown-label">Choose Company</span>
                       <span class="caret"></span>
                  </button>
                        <ul class="dropdown-menu dropdown-select" >
                             <li  data-value="2" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 1</a></li>
                             <li  data-value="38" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 2</a></li>
                             <li  data-value="42" data-field="bedrijfId"><a href="#"><input type="radio" name="drp1" />Company 3</a></li>
                        </ul>
          </div>
      </div>
       
      How do I select one of the companies from the dropdown menu?
      Thanks
      Joost
×