AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Retrieve the path of a running process

 
Reply to topic    AutoHotkey Community Forum Index -> Wish List
View previous topic :: View next topic  
Author Message
Diamond



Joined: 31 Mar 2006
Posts: 142
Location: New York

PostPosted: Thu Aug 03, 2006 4:38 pm    Post subject: Retrieve the path of a running process Reply with quote

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.
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4668
Location: Boulder, CO

PostPosted: Thu Aug 03, 2006 5:17 pm    Post subject: Reply with quote

This is a workaround, based on Shimanov's code
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
Back to top
View user's profile Send private message
Diamond



Joined: 31 Mar 2006
Posts: 142
Location: New York

PostPosted: Thu Aug 03, 2006 6:13 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Wish List All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group