Jump to content

To find winhandle with only process name?


Recommended Posts

^ TITLE

Yea, how can I retrieve the window name when I onlyknow the process name?

Thankss in advanced, for some reason, no matter how long I use autoit, I always hve these little questions ( sorry, I didnt wanna say newbish)

EDIT: XD there should be a ProcessGetWin function XD

Edited by MethodZero

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

Link to comment
Share on other sites

Func _GetWHNDLFromPID($PID, $WTitle="")
    Local $wHndl="", $WCCount=0, $WList
    Do
        Local $WList=WinList($WTitle)
        for $WLCount= 1 to $WList[0][0]
            if WinGetProcess($WList[$WLCount][1])=$PID Then
                $wHndl=$WList[$WLCount][1]
                ExitLoop
            EndIf
        Next
        if $WCCount = 400 Then Return -1
        Sleep(50)
        $WCCount += 1
    Until not($wHndl="")
    Return $wHndl
EndFuncoÝ÷ Û¥·­º¹íáÚÙ^¡ö­çâ®ËpwhÂ+_wl¶­Æ¬²"j×Â+a¶ :j¯zzk¡Ç¬±8^v¶°m§$ËajÖ©®²Éʯzj+zØZÞÂ)Ý£áÇîËb¢w(ºW[y§Z¦×¶Þ¶ê綡jwezÊjYpwhÂÇèºwm«[zZ'Ú¦ºz˺Ң}ý¶¯zئzÚ׫ÙèÀñ+ªl#¥Ó¹ëk'â®Ë©ÜxýX·}ÀÊ"*.r§ëazX§y«­¢+Ø$$$$ÀÌØíÝ!¹°ôÀÌØí]1¥ÍÑlÀÌØí]1
½Õ¹ÑulÅoÝ÷ ÚÚ¶§}í+ºÚ"µÍBBBIÌÍÝÒIÌÍÕÓÝÉÌÍÕÓÛÝ[VÌ

the function will return the window title instead of the Handle (But, in most cases, the Handle is the more useful of the two as the title can change)

Hope this helps!

Edited by improbability_paradox
Link to comment
Share on other sites

Thank you!

[center]"When you look at old, classic games like Snake, you often put it off because it's such a simple game, but it's only when you actually try and create your own unique game from scratch, do you finally appreciate those games."[/center][center]Don't ask for answers if you haven't TRIED yet![/center][center]Most answers can be answered in the help file! Use it![/center]

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...