Sign in to follow this  
Followers 0
Dirk Diggler

Check if active window is what u want

6 posts in this topic

I found that AutoIt hasn't variable or macros like @Activewindow. So, how i can check if active window title matches some regular expression?

Share this post


Link to post
Share on other sites



Maybe

$win = "Untitled -"
If WinActive($win) Then
    MsgBox(0, "", "Window was active")
EndIf

8)


NEWHeader1.png

Share this post


Link to post
Share on other sites

i explained wrong. it works when u know, what window title u need to check. In case you don't, how you can receive title of active window?

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

maybe this can help

Dim $num, $names
$var = WinList()

For $i = 1 to $var[0][0]
; Only display visble windows that have a title
  If $var[$i][0] <> "" AND IsVisible($var[$i][1]) Then
    $num = $num + 1
    $names = $names & $var[$i][0] & @CRLF
  EndIf
Next

Func IsVisible($handle)
  If BitAnd( WinGetState($handle), 2 ) Then
    Return 1
  Else
    Return 0
  EndIf

EndFunc


MsgBox(0, "Total Windows = " & $num, "Title's of all task bar Windows" & @CRLF & @CRLF & $names & "   ")

8)

Edited by Valuater

NEWHeader1.png

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

While he's making a long script, you could try this:

MsgBox(0, 'test', WinGetTitle(''))

Edit:

After reading this again, I don't think I'm following correctly...

HotKeySet('{end}', 'testtitle')
While 1
    Sleep(100000)
WEnd
Func testtitle()
    If StringInString(WinGetTitle(''), 'text in title I want') Then MsgBox(0, 'test', WinGetTitle(''))
EndFunc
This picks the active windows title, and then matches a string in it, if the statement is true, then the msgbox will appear... Is the right direction, or does Valauter have you on the right path? Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

All is right, WinGetTitle('') is that thing i'm searching for :o

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