Would it be possible to add a parameter to the "Process" command which would return the path of a running process in a variable? I think this would be useful and as far as I know there's no way to do it currently. I discovered this today when I wrote a simple script to show me the process name of the active window and I thought it would be nice if the path could be retrieved as well.
Retrieve the path of a running process
2 replies to this topic
This is a workaround, based on Shimanov's code
#Persistent CoordMode Mouse, Screen Settimer Info Return Info: MouseGetPos X, Y, WinID WinGet PID, PID, ahk_id %WinID% h_process := DllCall("OpenProcess", UInt,0x418, Int,0, UInt,PID) VarSetCapacity(Proc, 255) DllCall("psapi.dll\GetModuleFileNameExA", UInt,h_process, UInt,0, Str,Proc, UInt,255) DllCall("CloseHandle", h_process) ToolTip %Proc% Return
#2 - Posted 03 August 2006 - 04:17 PM
Wow that works great! I don't completely understand how or why it works, but it does. Some DLL calls to get the path? I modified it slightly to get what I was looking for. Thanks a lot. This would still be a useful feature to have built-in to AutoHotkey though for those of us who don't understand complicated things like DLL calls.
#3 - Posted 03 August 2006 - 05:13 PM