Sean wrote:
...I assume that you can get the PID of the application, and that the application is not a service. I posted one method to do it:
http://www.autohotkey.com/forum/viewtopic.php?t=16575
This is great! However, it doesn't always have the full path to the command whch started whatever pid I'm pointing at (doesn't happen that often thogh). If its easy, can you add that bit to your code?
btw: I tried to look at shimanov's code and :S
I'm using this script:
Code:
capslock & p::
if not watching
{
SetTimer, WatchCursor, 1
watching = 1
}
else
{
SetTimer, WatchCursor, off
watching = 0
}
return
WatchCursor:
if GetKeyState("LShift", "P")
{
clipboard = %sCmdLine%
}
else if GetKeyState("Esc", "P")
{
SetTimer,WatchCursor, off
Tooltip
return
}
MouseGetPos, , , id, control
WinGetTitle, title, ahk_id %id%
WinGetClass, class, ahk_id %id%
WinGet, pid, PID, %title%
VarSetCapacity(sCmdLine, 512)
pFunc := DllCall("GetProcAddress"
, "Uint", DllCall("GetModuleHandle", "str", "kernel32.dll")
, "str", "GetCommandLineA")
hProc := DllCall("OpenProcess", "Uint", 0x3A, "int", 0, "Uint", pid)
hThrd := DllCall("CreateRemoteThread", "Uint", hProc, "Uint", 0, "Uint", 0
, "Uint", pFunc, "Uint", 0, "Uint", 0, "Uint", 0)
DllCall("WaitForSingleObject", "Uint", hThrd, "Uint", 0xFFFFFFFF)
DllCall("GetExitCodeThread", "Uint", hThrd, "UintP", pcl)
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pcl, "str", sCmdLine, "Uint", 512, "Uint", 0)
DllCall("CloseHandle", "Uint", hThrd)
DllCall("CloseHandle", "Uint", hProc)
ToolTip, LShfit: copies to clipboard`, ESC removes tooltip.`n%sCmdLine%
return