AGlassman Posted September 10, 2023 Share Posted September 10, 2023 (edited) As best as I can tell (see example code and output) the "ACTIVE" property, unlike the other properties, is OR'd not AND'd with any other properties present. I can fully understand if this was by design. But if so, then a note on the "Window Titles and Text (Advanced)" help page might be in order. expandcollapse popup#include <WinAPISysWin.au3> Example() Func Example() ConsoleWrite( "AutoItVersion: " & @AutoItVersion & @CRLF ) Local $hWnd = WinGetHandle( "[ACTIVE]" ) Local $Title = StringRight( WinGetTitle($hWnd), 5 ) ConsoleWrite( "Active Window Title match string: '" & $Title & "'" & @CRLF ) Local $Class = _WinAPI_GetClassName( $hWnd ) ConsoleWrite( "Active Window Class match string: '" & $Class & "'" & @CRLF ) ConsoleWrite( @CRLF ) Local $AWD_RETitle = "[REGEXPTITLE:" & $Title & "]" ConsoleWrite( "RETitle Property: '" & $AWD_RETitle & "'" & @CRLF ) ConsoleWrite( "RETitle Match: " & WinExists( $AWD_RETitle ) & @CRLF ) Local $AWD_REClass = "[REGEXPCLASS:" & $Class & "]" ConsoleWrite( "REClass Property: '" & $AWD_REClass & "'" & @CRLF ) ConsoleWrite( "REClass Match: " & WinExists( $AWD_REClass ) & @CRLF ) Local $AWD_RETC = "[REGEXPTITLE:" & $Title & "; REGEXPCLASS:" & $Class & "]" ConsoleWrite( "RETC Property: '" & $AWD_RETC & "'" & @CRLF ) ConsoleWrite( "RETC Match: " & WinExists( $AWD_RETC ) & @CRLF ) $Class = "XXXX" Local $AWD_RETC = "[REGEXPTITLE:" & $Title & "; REGEXPCLASS:" & $Class & "]" ConsoleWrite( "RETC Property: '" & $AWD_RETC & "'" & @CRLF ) ConsoleWrite( "RETC Match: " & WinExists( $AWD_RETC ) & @CRLF ) $Title = "XXXX" Local $AWD_RETA = "[REGEXPTITLE:" & $Title & "; ACTIVE]" ConsoleWrite( "RETA Property: '" & $AWD_RETA & "'" & @CRLF ) ConsoleWrite( "RETA Match: " & WinExists( $AWD_RETA ) & @CRLF ) Local $AWD_RETCA = "[REGEXPTITLE:" & $Title & "; REGEXPCLASS:" & $Class & "; " & "ACTIVE" & "]" ConsoleWrite( "RETCA Property: '" & $AWD_RETCA & "'" & @CRLF ) ConsoleWrite( "RETCA Match: " & WinExists( $AWD_RETCA ) & @CRLF ) Local $AWD_REATA = "[ACTIVE; REGEXPTITLE:" & $Title & "; REGEXPCLASS:" & $Class & "]" ConsoleWrite( "REATA Property: '" & $AWD_REATA & "'" & @CRLF ) ConsoleWrite( "REATA Match: " & WinExists( $AWD_REATA ) & @CRLF ) EndFunc AutoItVersion: 3.3.16.1 Active Window Title match string: 'SciTE' Active Window Class match string: 'SciTEWindow' RETitle Property: '[REGEXPTITLE:SciTE]' RETitle Match: 1 REClass Property: '[REGEXPCLASS:SciTEWindow]' REClass Match: 1 RETC Property: '[REGEXPTITLE:SciTE; REGEXPCLASS:SciTEWindow]' RETC Match: 1 RETC Property: '[REGEXPTITLE:SciTE; REGEXPCLASS:XXXX]' RETC Match: 0 RETA Property: '[REGEXPTITLE:XXXX; ACTIVE]' RETA Match: 1 RETCA Property: '[REGEXPTITLE:XXXX; REGEXPCLASS:XXXX; ACTIVE]' RETCA Match: 1 REATA Property: '[ACTIVE; REGEXPTITLE:XXXX; REGEXPCLASS:XXXX]' REATA Match: 1 Edited September 10, 2023 by AGlassman 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