Jump to content

Detect window


Recommended Posts

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?

Link to comment
Share on other sites

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

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

 

Link to comment
Share on other sites

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

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

 

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...