Sign in to follow this  
Followers 0
jaenster

Get the focused window

5 posts in this topic

msgbox(0,"Found it",getfocus())
func getfocus()
    $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
            If WinActive($var[$i][0]) Then
                return $var[$i][0]
            endif
        ;MsgBox(0, "Details", "Title=" & $var[$i][0] & @LF & "Handle=" & $var[$i][1])       
        EndIf
    Next
    seterror(1)
    return -1
endfunc

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

EndFunc

I dont think that you need some details..


-jaenster

Share this post


Link to post
Share on other sites



Works that too :o sorry


-jaenster

Share this post


Link to post
Share on other sites

Sorry if i re take this old post,

Func and WinGetTitle("") work very well.

But i've a question. Is possible to return as applications identifier, .exe name ?

i use Italian version of xp, a lot of exe have name that can generate 'confusion'.

I read about class but also this item give me some limit for little tool that i want to build.

(mouse gesture tool, based on .exe, so anyone can build his macro)

Anyone can help me?

Thank you

m.

Share this post


Link to post
Share on other sites

Hello

Use

WinGetProcess("") ;Returns PID of the active window.

If u wanna exe name use _ProcessGetName()

Your Spider


www.AutoIt.de - Moderator of the German AutoIt Froum

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