DonationCoder.com Software > Post New Requests Here
Need ADH Advice
Kruskal:
You, Skrommel, were kind enough to write a AHK program for me to provide a hotkey to display a little window showing what program owns the window under the cursor. When pushed a second time, the little window goes away. I use it all the time. (Program at end).
I tried to modify it to be a simple program, rather than a hotkey by removing this line:
!^w::
It sort of works, but the feature of the second call clearing the little window is gone. I don't know the AHK script language at all. Any idea what I did wrong.
Thanks -- Vincent
PS I wonder why you haven't made this one of your publicly available (or did I miss it). I find it invaluable.
--- Code: AutoIt ---;AutoHotkeys.ahk;Vincent Kruskal's Hotkeys;Skrommel @ 2007;Kruskal @ 2007 #SingleInstance,Force#NoEnv !^w:: If ToolTipFlag= { MouseGetPos,x,y,winid,ctrlid WinGet,pid,Pid,ahk_id %winid% path:=GetModuleFileNameEx(pid) ToolTip,%path% ToolTipFlag = 1 } Else { ToolTip, ToolTipFlag = } 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 { 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 }
Edit by Skwire: Added code tags.
Target:
if you remove the hotkey, how do you fire the script off?
i think the answer is to use a delay then to destroy the tooltip (but the above still applies...)
note that the code is untested, but I've just omitted the unnecessary lines so it should work as is
--- ---;AutoHotkeys.ahk
;Vincent Kruskal's Hotkeys
;Skrommel @ 2007
;Kruskal @ 2007
#SingleInstance,Force
#NoEnv
!^w::
MouseGetPos,x,y,winid,ctrlid
WinGet,pid,Pid,ahk_id %winid%
path:=GetModuleFileNameEx(pid)
ToolTip,%path%
Sleep, 2500 ;this introduces a delay (in milliseconds). Change the value to whatever suits
ToolTip,
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
{
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
}
Kruskal:
if you remove the hotkey, how do you fire the script off?
i think the answer is to use a delay then to destroy the tooltip (but the above still applies...)
note that the code is untested, but I've just omitted the unnecessary lines so it should work as is
[snip] -Target (May 06, 2010, 08:39 PM)
--- End quote ---
I use PowerPro to issue the EXE compiled from the AHK code. I've been having trouble with some timing problem which reorders my keystrokes when the computer is stressed. I thought switching to just one key grabber might fix it.
I can see how the delay would work and it might be OK. But I really prefer the previous behavior. How did the original work wrt making the little window disappear everyother use?
Thanks -- Vincent
skwire:
I tried to modify it to be a simple program-Kruskal (May 06, 2010, 08:09 PM)
--- End quote ---
What was your expectation after doing this?
How did the original work wrt making the little window disappear everyother use?-Kruskal (May 06, 2010, 09:41 PM)
--- End quote ---
It uses the "ToolTipFlag" variable as a toggle to determine whether to display the display the tooltip or cause it to disappear.
Target:
the conditional IF statement determines what happens depending on the value of the tooltipflag variable - IF the variable contains a value, show the tooltip and , ELSE clear the tooltip
the reason it's not working for you without the hotkey (and I'm assuming you're compiling it) is that it resets the flag every time and the code that clears the tooltip is never called
Navigation
[0] Message Index
[#] Next page
Go to full version