Sign in to follow this  
Followers 0
sumitd

Differentiate between 2 windows with same name/title

10 posts in this topic

How do i  differentiate between 2 windows with same name/title ?

Though both have same name but content and processing fields is different.

And 1 of the window may not appear all the time while the script executes.

Tried with WinWaitActive ( "<title>" , " " , 1000 ), but not able to differentiate.

Any suggestions?

Share this post


Link to post
Share on other sites



Hi,

Each window has a handle which is unique, you can do a WinList with a title then keep the handles when you have differentiated the windows.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

hi sumitd

have you tryed to use the second parameter of the WinWaitActive() function?,
it is used to search a text inside the windows body instead of only the title

bye


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

hi Prodigy,

I tried with the text option in WinWaitActive() function, but it doesn't seem to differentiate.

FireFox,

how do I use WinList and the handle to differentiate between windows? (In my case 1 of the window may not appear all the time)

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

I don't know what you mean by "not appear", if this mean hidden then try this :

Local $aWl = WinList("mytitle")
If $aWl[0][0] = 0 Then Exit 1

Local $hWndNotAlwaysVisible = 0

While 1
    For $i = 1 To $aWl[0][0]
        If IsVisible($aWl[$i][1]) = 0 Then
            $hWndNotAlwaysVisible = $aWl[$i][1]
            ExitLoop 2
        EndIf
    Next
    Sleep(10)
WEnd

WinSetState($hWndNotAlwaysVisible, "", @SW_SHOW)

Func IsVisible($hWnd)
    If BitAND(WinGetState($hWnd), 2) Then Return 1
    Return 0
EndFunc   ;==>IsVisible
Br, FireFox. Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

If it is possible use a hidden label and search for this text in a loop of Winlist.

Then get hwnd of the win you want to identify.

Greetings

Adom


Thanks! :bye:

Greetings

Andrew

 

Share this post


Link to post
Share on other sites

Firefox,

The window is not hidden. What I meant was that the windows are a part of installation process and both window pop out if only a previous installation is detected,

else only 1 of the window appears in the installation process.

~sumitd

Share this post


Link to post
Share on other sites

hm. The only way for you to differentiate them is to read their text using the ControlGetText function (use the Au3Info tool for that).

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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