techcord Posted August 26, 2014 Share Posted August 26, 2014 How do you detect a dialog box inside of a program that has the same title and class of the parent program? I have done some searching, and I have not been able to find a solution. How do I get Autoit to differentiate between the parent program and the pop-up dialog box. What can I use to tell the difference between the two? Any advice would be much appreciated, thank you in advance. Link to comment Share on other sites More sharing options...
JohnOne Posted August 26, 2014 Share Posted August 26, 2014 Its handle. 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...
techcord Posted August 27, 2014 Author Share Posted August 27, 2014 So what would I use to wait for a handle? Link to comment Share on other sites More sharing options...
junkew Posted August 27, 2014 Share Posted August 27, 2014 instance: 2 in your recognition pattern and not only use title and class FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
JohnOne Posted August 27, 2014 Share Posted August 27, 2014 Winlist() is a good place to start. 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...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 Winlist() is a good place to start. Well if I could give you a hug I would, Thanks for your help! Link to comment Share on other sites More sharing options...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 Okay hold that hug, the handle changes every time I run the program, Link to comment Share on other sites More sharing options...
MikahS Posted September 2, 2014 Share Posted September 2, 2014 (edited) WinGetHandle Edited September 2, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 Yes but how do I know what window has the handle I want? Link to comment Share on other sites More sharing options...
junkew Posted September 2, 2014 Share Posted September 2, 2014 Window advanced description instance syntax will help FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
MikahS Posted September 2, 2014 Share Posted September 2, 2014 WinGetHandle is not case-sensitive so you can match it with "notepad" even though the title is "Untitled - notepad". Otherwise, junkew gave a good push. Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
JohnOne Posted September 2, 2014 Share Posted September 2, 2014 Okay hold that hug, the handle changes every time I run the program, And winlist will you that handle every time you run your script. 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...
junkew Posted September 2, 2014 Share Posted September 2, 2014 (edited) Native AutoIT using instance: n https://www.autoitscript.com/autoit3/docs/intro/controls.htm or with example 32 #include "UIAWrappers.au3" AutoItSetOption("MustDeclareVars", 1) _UIA_setVar("browser1.mainwindow","classname:=IEFrame;controltype:=WindowControl;instance:=1") _UIA_action("browser1.mainwindow","setfocus") Edited September 2, 2014 by junkew FAQ 31 How to click some elements, FAQ 40 Test automation with AutoIt, Multithreading CLR .NET Powershell CMDLets Link to comment Share on other sites More sharing options...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 But both windows in the program have the same everything, except for the handle; that I have found so far. The handle changes each time I run the program and get a new popup window. How to identify this pop up window? Link to comment Share on other sites More sharing options...
JohnOne Posted September 2, 2014 Share Posted September 2, 2014 Get handle of main window upon start, use winlist to identify all windows of that name, check the handles, if it does not match the original it is the popup. 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...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 The loading screen requires a username and password, has same everything. Then the program has the same everything, then every pop up has the same everything, and after a while a re-log on screen pops up, same everything also. Granted your solution would work for the first logon screen but not the last re-log on. Link to comment Share on other sites More sharing options...
BrewManNH Posted September 2, 2014 Share Posted September 2, 2014 Either all the windows have the same handle or they don't which is it? 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 GudeHow 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 Link to comment Share on other sites More sharing options...
techcord Posted September 2, 2014 Author Share Posted September 2, 2014 Different handles, same names and everything else, what can I do to find the one I need? Link to comment Share on other sites More sharing options...
JohnOne Posted September 2, 2014 Share Posted September 2, 2014 Make this easier and provide the name of the program. 232showtime 1 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...
BrewManNH Posted September 2, 2014 Share Posted September 2, 2014 Different handles, same names and everything else, what can I do to find the one I need? Did you read post #15 at all? Get the handles that are already there, then wait for a new one to show up, that should be your pop up window. 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 GudeHow 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 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