Page 1 of 1

Get window title/hwnd from process name?

Posted: 06 Jun 2014, 00:56
by alvitawa
How can I do it?

Re: Get window title/hwnd from process name?

Posted: 06 Jun 2014, 02:24
by just me
You might use the ahk_exe option for the WinTitleparameter.

Re: Get window title/hwnd from process name?

Posted: 06 Jun 2014, 02:28
by Menixator

Code: Select all

processName := "notepad.exe"
if (WinExist("ahk_exe " . processName)){
	WinGetTitle, title, ahk_exe %processName%
	MsgBox The title of the window is %title%
} else {
	MsgBox The process "%ProcessName%" doesn't exist.
}
You can use the WinGetTitle command with ahk_exe %the_process_name% as the title parameter..

Re: Get window title/hwnd from process name?

Posted: 06 Jun 2014, 14:10
by alvitawa
Ok thank you!