[FUNCTION] getActiveProcessName() - Process name of active window (inc. Win 10)

Post your working scripts, libraries and tools
SifJar
Posts: 398
Joined: 11 Jan 2016, 17:52

[FUNCTION] getActiveProcessName() - Process name of active window (inc. Win 10)

23 Feb 2016, 10:15

getActiveProcessName() Original post

Simple function (and second necessary function) to return the name of the EXE responsible for the current process. This is particularly useful on Windows 10 (and 8), where "universal" (or "UWP") apps (e.g. Windows store apps, built in apps like Calculator etc.) do not return the correct PID/process name using regular AHK commands, and therefore cannot be distinguished easily. However, the function also works for traditional programs.

Usage is very simple, simply call getActiveProcessName() and the value returned from the function will be the process name of the currently active window.

Code: [Select all] [Expand] [Download] (getActiveProcessName.ahk)GeSHi © Codebox Plus



Feedback is welcome.

EDIT: Superior version by Lexikos available here
malcev
Posts: 94
Joined: 12 Aug 2014, 12:37

Re: [FUNCTION] getActiveProcessName() - Process name of active window (inc. Win 10)

15 Aug 2018, 17:38

Every new tab in Microsoft IE and Microsoft Edge has own process which is different from process of main window.
Your code does not show them.
This code shows process name and pid of focused control:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Or like this:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus


Return to “Scripts and Functions”

Who is online

Users browsing this forum: No registered users and 20 guests