Jump to content
Sign in to follow this  
techcord

How do you detect a dialog box inside of a program, same title?

Recommended Posts

techcord

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.

Share this post


Link to post
Share on other sites
techcord

So what would I use to wait for a handle?

Share this post


Link to post
Share on other sites
techcord

Winlist() is a good place to start.

Well if I could give you a hug I would, Thanks for your help!

Share this post


Link to post
Share on other sites
techcord

Okay hold that hug, the handle changes every time I run the program, :(

Share this post


Link to post
Share on other sites
MikahS

WinGetHandle

Edited by MikahS

Snips & Scripts


My Snips: graphCPUTemp ~ getENVvars
My 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

 

Share this post


Link to post
Share on other sites
techcord

Yes but how do I know what window has the handle I want?

Share this post


Link to post
Share on other sites
MikahS

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 ~ getENVvars
My 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

 

Share this post


Link to post
Share on other sites
junkew

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 by junkew

Share this post


Link to post
Share on other sites
techcord

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?

Share this post


Link to post
Share on other sites
techcord

 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.

Share this post


Link to post
Share on other sites
BrewManNH

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 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
techcord

Different handles, same names and everything else, what can I do to find the one I need?

Share this post


Link to post
Share on other sites
BrewManNH

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 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

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  

×