Sign in to follow this  
Followers 0
JohnOne

windowpains

8 posts in this topic

#1 ·  Posted (edited)

Im having a nightmare trying to automate the clicking of an external gui button, below is the culprit.

Posted Image

Window info.

>>>> Window <<<<

Title: Windows Internet Explorer

Class: #32770

Position: 216, 292

Size: 377, 172

Style: 0x94C801C5

ExStyle: 0x00010101

Handle: 0x002C0772

>>>> Control <<<<

Class: Button

Instance: 1

ClassnameNN: Button1

Name:

Advanced (Class): [CLASS:Button; INSTANCE:1]

ID: 6

Text: &Yes

Position: 107, 106

Size: 75, 23

ControlClick Coords: 45, 9

Style: 0x50030001

ExStyle: 0x00000004

Handle: 0x004306CE

>>>> Mouse <<<<

Position: 155, 144

Cursor ID: 2

Color: 0xECE9D8

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

&Yes

&No

Stop running this script?

A script on this page is causing Internet Explorer to run slowly.

If it continues to run, your computer might become

unresponsive.

>>>> Hidden Text <<<<

Example code , I have tried more.

#include <Array.au3>

Opt("WinTitleMatchMode", 2) ;Tried all Flags, and no option

While 1
    If WinExists("Windows Internet Explorer") Then
        MsgBox(0,"","Exists") ;MsgBox never appears so cannot get gui handle
    EndIf
    
    $aWinList = WinList() 
    _ArrayDisplay($aWinList) ;The window is listed in the array, as is its correct handle
    
    $aWinList = WinList("Windows Internet Explorer")
    If IsArray ($aWinList) And $aWinList[0][0] > 0 Then
        _ArrayDisplay($aWinList) ;The window is listed in the array as the only one in it, with correct handle
    EndIf   
    
    Sleep(100)
WEnd

I have tried using the handle returned in the winlist() array to controlclick the button, but without success.

I seem to remember having a similar problem with another gui at one time and solved it but cannot remember what the problem was and how I greeted it.

Any help greatly accepted.

EDIT: more descriptive title.

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



It will always show up in the same place, try just clicking the button you want using the MouseClick and the WinExists function.

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I had pondered that but its not really solving the issue and it would be useless on other screen relolutions/sizes etc...

I welcome your suggestion though, thanks.

EDIT:

Maybe I hadnt explained well enough, the winexists() function decides that the window is not there.

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

See if adding the 'text' parameter helps, see if the following returns the correct handle compared to the autoit info window

$hWnd = WinGetHandle("Windows Internet Explorer","Stop running this script?")
ConsoleWrite($hWnd & @CR)

GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Thanks, I had tried that before but no joy.

I got it working in the end with winactivate used in an incorrect way, but winexists will not aknowledge the window.

But it still refused a control click by Class:. Luckily I noticed that the ID was the same each time the window appeared, so I tried that and it works.

Opt("WinTitleMatchMode", 2)

While 1
    $hkill = WinActivate("Windows Internet Explorer")
    If $hkill > 0 Then
        ControlClick($hkill, "", 6)
        Sleep(100)
    EndIf
WEnd

The big question now is, will the ID be the same on a different machine/OS?

Anyone shed any light on that?

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

lol

I spoke too soon.

It will not work but I have more info, which could be the root of my woes.

The above code will work from a different script but will not work in the loop of the gui that spawns the msg. some sort of child window maybe?

Anyway Im back to square 1 niether winexists or winactivate will aknowledge the window.


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

Can you give a link of a site that causes this msgbox to pop up from internet explorer?


GDIPlusDispose - A modified version of GDIPlus that auto disposes of its own objects before shutdown of the Dll using the same function Syntax as the original.EzMySql UDF - Use MySql Databases with autoit with syntax similar to SQLite UDF.

Share this post


Link to post
Share on other sites

I'd sooner not, suffice to say im loading a flash movie object into the GUI rather than the whole webpage.

The movie will definately not be everyones cup of tea :idea: and the link to it contains my UID, and direct link into my account.

Ive confirmed that the popup msg is halting my script waiting for its own input, so my only conclusion is to start another script to deal with the msg, unless I can find another solution, which I think is pretty unlikely.

Thank you for your time Yoriz.


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

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