Jump to content
Sign in to follow this  
JohnBailey

Get Window Title using Handle (HWnd)

Recommended Posts

How do I get a window title using the a windows handler (Hwnd)?

$sTitle = WinGetTitle($hWin)

AutoIt will take a handle in place of the title string to specify a window.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Just be sure to set Opt("WinTitleMatchMode",4) ;)

You don't have to do that to use handles, but you do if you want to use "[CLASS:]" style attributes.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

but you do if you want to use "[CLASS:]" style attributes.

:)

Only if you are using the old ways classname=#32770 versus [CLASS:#32770]

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.

Share this post


Link to post
Share on other sites

Only if you are using the old ways classname=#32770 versus [CLASS:#32770]

Did not realize that...

I'm done! Go'n home for the day! Learned my new thing for day!

Run("notepad.exe")
$i = 0
Do
    Sleep(20)
    $hWin = WinGetHandle("[CLASS:Notepad; TITLE:Untitled - Notepad]")
    $i += 1
Until IsHWnd($hWin)
MsgBox(64, "Test", "Got handle in " & $i & " tries.")
WinClose($hWin)
$hWin = 0

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

Did not realize that...

I'm done! Go'n home for the day! Learned my new thing for day!

Run("notepad.exe")
$i = 0
Do
    Sleep(20)
    $hWin = WinGetHandle("[CLASS:Notepad; TITLE:Untitled - Notepad]")
    $i += 1
Until IsHWnd($hWin)
MsgBox(64, "Test", "Got handle in " & $i & " tries.")
WinClose($hWin)
$hWin = 0

:)

I only found out by someone pointing it out to me the other day... guess I missed the "You don't have to anymore post" as well.

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.

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  

×
×
  • Create New...