Jump to content
Sign in to follow this  
sakshi

Detect window

Recommended Posts

sakshi

I am automating a task in which a window is active after the processing is done another window gets active with the same title.

and the text in this window keeps changing so

the issue is how to detect this window is active or not?

it has a different classname so could that help to detect it if its the active window?

i.e. how to dtect a window active using title and classname?

Share this post


Link to post
Share on other sites
wolf9228

I am automating a task in which a window is active after the processing is done another window gets active with the same title.

and the text in this window keeps changing so

the issue is how to detect this window is active or not?

it has a different classname so could that help to detect it if its the active window?

i.e. how to dtect a window active using title and classname?

#include <WinAPI.au3>
HotKeySet("{ESC}", "Terminate")
Run("Notepad.exe", "", @SW_MAXIMIZE)


While 1
TrayTip("RT",IsActiveWindow("[CLASS:Notepad]"),10)
Sleep(100)
WEnd


Func IsActiveWindow($Class)
$hWnd1 = _WinAPI_GetForegroundWindow()
$hWnd2 = WinGetHandle ($Class, "")
if $hWnd1 == $hWnd2 Then Return True
Return False
EndFunc

Func Terminate()
    Exit 0
EndFunc

صرح السماء كان هنا

 

Share this post


Link to post
Share on other sites
wolf9228

WINDOW1 = "[CLASS:Notepad;INSTANCE:1]"

WINDOW2 = "[CLASS:Notepad;INSTANCE:2]"

WINDOW3 = "[CLASS:Notepad;INSTANCE:3]"

WINDOW4 = "[CLASS:Notepad;INSTANCE:4]"

WINDOW1 = "[CLASS:Notepad;INSTANCE:1]"
WINDOW2 = "[CLASS:Notepad;INSTANCE:2]"
WINDOW3 = "[CLASS:Notepad;INSTANCE:3]"
WINDOW4 = "[CLASS:Notepad;INSTANCE:4]"

صرح السماء كان هنا

 

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.