further to skwires explanation here's an example that writes to an ini file, but as he says, as soon as the exe...umm... exits, any windows or values are lost
;AutoHotkeys.ahk
;Vincent Kruskal's Hotkeys
;Skrommel @ 2007
;Kruskal @ 2007
#SingleInstance,Force
#NoEnv
iniread, tooltipflag, VKh.ini, flag, status
If ToolTipFlag = 0
{
MouseGetPos,x,y,winid,ctrlid
WinGet,pid,Pid,ahk_id %winid%
path:=GetModuleFileNameEx(pid)
ToolTip,%path%
iniwrite, 1, VKH.ini, flag, status
}
Else
{
ToolTip,
iniwrite,0, VKH.ini, flag, status
}
sleep, 5000
exitapp
Return
#q::
SoundPlay,C:\Documents and Settings\Administrator\My Documents\My Sound Effects\silence.wav
Return
GetModuleFileNameEx(p_pid) ;by shimanov at www.autohotkey
{
If A_OSVersion in WIN_95,WIN_98,WIN_ME,WIN_XP
{
WinGet,name,ProcessName,ahk_id %p_pid%
Return,name
}
h_process:=DllCall("OpenProcess","uint",0x10|0x400,"int",false,"uint",p_pid) ; PROCESS_VM_READ=0x0010 PROCESS_QUERY_INFORMATION=0x0400
If (ErrorLevel or h_process=0)
Return
name_size=255
VarSetCapacity(name,name_size)
result:=DllCall("psapi.dll\GetModuleFileNameExA","uint",h_process,"uint",0,"str",name,"uint",name_size)
DllCall("CloseHandle",h_process)
Return,name
}
and the only reason this one works is because there's a short delay at the end to display the tooltip...
seems like the original solution might still be the best one for your situation
just out of curiosity is there any reason why you couldn't translate the script into powerpro? I suspect this may alleviate a lot of the issues you're experiencing (don't ask me, I don't know the language, but my feeling is that it shouldn't be that hard to do... hehe, famous last words...)