Jump to content

ControlGetPos()


JohnOne
 Share

Recommended Posts

Can someone check that controlgetpos() returns the correct position of the browser

area of Internet explorer?

I'm using IE 8 and for me it returns incorrect Y pos

It return 67 for me, when the actual mouse Y pos is 89 (Maximized)

Opt("WinTitleMatchMode",2)

$wind = "Windows Internet Explorer"
$Class = "[CLASS:Internet Explorer_Server; INSTANCE:1]"

WinActivate($wind)

$pos = ControlGetPos($wind,"",$Class)

If IsArray($pos) Then
ConsoleWrite($pos[0] & @LF & $pos[1] & @LF & $pos[2] & @LF & $pos[3] & @LF )

MouseMove($pos[0],$pos[1])
EndIf

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

What IE version are you using?

EDIT:

There are no toolbars, that script moves the mouse half way up the IE favourites button for me.

Works fine on all other windows I've tried, including chrome with and without toolbars.

Just seems to be IE, it's cracking me up a bit.

Edited by JohnOne

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Im using 8.

It doesnt move on favorite button for me. Just a random mousemove on the screen.

But thats normal depends on the display setting u have on ur browser.

Even though if u want to click on a button use some coords on ur mouse or do an IE click why bothering like this

I feel nothing.It feels great.

Link to comment
Share on other sites

It's not random,your mouse should move to x,y co-ordinates 0,98 for you

which should be the top left of actual browser area of IE.

If I want to draw something on a control I need to know where that control is

and It's just not finding it for me.

If you change ControlgetPos to WingetPos() (obviously remove $Class) what do you get

for IE xy, I get -8,-8 which is also weird because I'd expect 0,0.

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

What seems to be going on here is, the window is located at Y pos -8

and it seems to be the client area of the window being returned rather than the control position.

Doing my head in, anyone else see this behaviour?

EDIT:

Here is another issue, I have noticed while trying to solve this.

Window is maximized

WinMove($wind,"",0,0) ; does not work, window is not moved (unexpected)
WinMove($wind,"",-1,-1) ; Moves window to 7,7 (unexpected)
WinMove($wind,"",1,1) ; Moves window to 1,1 (expected)
Edited by JohnOne

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

Shameless Bump.

I just want to find out if it is only me who gets these results, I know the other poster said no.

All you have to do is have an IE window open, and window info tool unfrozen , run script, and tell me the

control info from the window info tool.

Opt("WinTitleMatchMode", 2)
Local $aCPos = _IEBrowserControlXY()
MouseMove($aCPos[0], $aCPos[1])
WinActivate("AutoIt v3 Window Info")
Sleep(200)
Send("^!f")


Func _IEBrowserControlXY()
Local $aXY[2] = [0, 0]
Local $Wind = "Windows Internet Explorer"
Local $Class = "[CLASS:Internet Explorer_Server; INSTANCE:1]"
Local $Winpos = WinGetPos($Wind)
Local $pos = ControlGetPos($Wind, "", $Class)

WinActivate($Wind)

If IsArray($pos) Then
$aXY[0] = $Winpos[0] + $pos[0]
$aXY[1] = $Winpos[1] + $pos[1]
EndIf

Return $aXY
EndFunc   ;==>_IEBrowserControlXY
Edited by JohnOne

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

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I run Windows 7 64 Bit and IE 9. The Window Info Tool, Control Tab doesn't show any data.

Here is a screenshot of the mouse position.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

>>>> Window <<<<
Title: ControlGetPos() - General Help and Support - AutoIt Forums - Windows Internet Explorer
Class: IEFrame
Position: -8, -8
Size: 1456, 886
Style: 0x17CF0000
ExStyle: 0x00000100
Handle: 0x0003002C
>>>> Control <<<<
Class: Internet Explorer_Server
Instance: 1
ClassnameNN: Internet Explorer_Server1
Name:
Advanced (Class): [CLASS:Internet Explorer_Server; INSTANCE:1]
ID:
Text:
Position: 0, 93
Size: 1440, 785
ControlClick Coords: 0, 1
Style: 0x56000000
ExStyle: 0x00000000
Handle: 0x0001020A
>>>> Mouse <<<<
Position: 0, 86
Cursor ID: 2
Color: 0xD8DDE8
>>>> StatusBar <<<<
>>>> ToolsBar <<<<
>>>> Visible Text <<<<
Navigation Bar
[url="http://www.autoitscript.com/forum/topic/144892-controlgetpos/"]http://www.autoitscript.com/forum/topic/144892-controlgetpos/[/url]
Address Combo Control
Page Control
Favorites and Tools Bar
LinksBand
Favorites Bar
Add to Favorites bar
ControlGetPos() - General Help and Support - AutoIt Forums - Windows Internet Explorer

>>>> Hidden Text <<<<

Edited by ileandros

I feel nothing.It feels great.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...