JohnOne Posted May 22, 2010 Share Posted May 22, 2010 (edited) Im having a nightmare trying to automate the clicking of an external gui button, below is the culprit. 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 May 22, 2010 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 More sharing options...
403forbidden Posted May 22, 2010 Share Posted May 22, 2010 It will always show up in the same place, try just clicking the button you want using the MouseClick and the WinExists function. Link to comment Share on other sites More sharing options...
JohnOne Posted May 22, 2010 Author Share Posted May 22, 2010 (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 May 22, 2010 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 More sharing options...
Yoriz Posted May 22, 2010 Share Posted May 22, 2010 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. Link to comment Share on other sites More sharing options...
JohnOne Posted May 22, 2010 Author Share Posted May 22, 2010 (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 WEndThe big question now is, will the ID be the same on a different machine/OS?Anyone shed any light on that? Edited May 22, 2010 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 More sharing options...
JohnOne Posted May 22, 2010 Author Share Posted May 22, 2010 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. Link to comment Share on other sites More sharing options...
Yoriz Posted May 22, 2010 Share Posted May 22, 2010 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. Link to comment Share on other sites More sharing options...
JohnOne Posted May 22, 2010 Author Share Posted May 22, 2010 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 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now