Sign in to follow this  
Followers 0
E1M1

how get win title from process.exe?

7 posts in this topic

How I can get window title if I know only Process_Name.exe ?


edited

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

AutoItWinGetTitle ( )

[edit] yeah.. probably not what you want...

Edited by SpookMeister

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

this command works only for autoit windows.


edited

Share this post


Link to post
Share on other sites

heh.. well its a bit of a long way around.... but you could get the PID of the process with ProcessExists()

Then get an array of all window titles from WinList, then go through each title that isn't "" and do a WinGetProcess() to compare PID's

I'm sure there is a more elegant solution... I just don't know of it off hand.


[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I dont like winlist() for this thing. I also tried google but I didn't find any help.

then how I need another language(maybe).

if so then can you recommend me some more keywords to search from google?

I already tried(no needed source/command/function found)

c++ how to get windows title from process

c++ how to find window by process

c++ how to find window by pid

I also tried search from process and WinAPI functions from msdn.

I remember I have seen script like I need in past, but I dont remember how it did that and where I saw it

Edited by E1M1

edited

Share this post


Link to post
Share on other sites

#627659

To get the handle after you have the process ID.

Share this post


Link to post
Share on other sites

An example of what I was talking about in case you change your mind... It's not that tricky

$return = _GetWinTitleFromProcName("SciTE.exe")
ConsoleWrite($return & @CRLF)

Func _GetWinTitleFromProcName($s_ProcName)
    $pid = ProcessExists($s_ProcName)
    $a_list = WinList()
    For $i = 1 To $a_list[0][0]
        If $a_list[$i][0] <> "" Then
            $pid2 = WinGetProcess($a_list[$i][0])
            If $pid = $pid2 Then Return $a_list[$i][0]
        EndIf
    Next
EndFunc   ;==>_GetWinTitleFromProcName

[u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote]

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