k3ph
Joined: 20 Jul 2006 Posts: 174
|
Posted: Thu Jul 17, 2008 10:12 pm Post subject: Fastkey for GoogleTalk |
|
|
this is a derivation of http://www.autohotkey.com/forum/viewtopic.php?t=32945
| Code: | #NoEnv
#SingleInstance Force
SetTitleMatchMode 2
#Persistent
SetBatchLines, -1
DetectHiddenWindows, On
appskey::
switch := !switch
if switch {
sendGoogleTalkmessage()
} else {
postmessage, 0x112, 0xF060,,, ahk_class Google Talk - Google Xmpp Client GUI Window
}
return
sendGoogleTalkmessage()
{
idxTB := GetTrayBar()
WinGet, pidTaskbar, PID, ahk_class Shell_TrayWnd
hProc := DllCall("OpenProcess", "Uint", 0x38, "int", 0, "Uint", pidTaskbar)
pRB := DllCall("VirtualAllocEx", "Uint", hProc, "Uint", 0, "Uint", 20, "Uint", 0x1000, "Uint", 0x4)
VarSetCapacity(btn, 20)
VarSetCapacity(nfo, 24)
VarSetCapacity(sTooltip, 128)
VarSetCapacity(wTooltip, 128 * 2)
sendmessage, 0x418, 0, 0, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd
loop, %ErrorLevel%
{
sendmessage, 0x417, A_Index - 1, pRB, ToolbarWindow32%idxTB%, ahk_class Shell_TrayWnd
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", pRB, "Uint", &btn, "Uint", 20, "Uint", 0)
iBitmap := NumGet(btn, 0)
idn := NumGet(btn, 4)
Statyle := NumGet(btn, 8)
dwData := NumGet(btn,12)
iString := NumGet(btn,16)
DllCall("ReadProcessMemory", "Uint", hProc, "Uint", dwData, "Uint", &nfo, "Uint", 24, "Uint", 0)
hWnd := NumGet(nfo, 0)
nMsg := NumGet(nfo, 8)
WinGet, sProcess, ProcessName, ahk_id %hWnd%
if ("googletalk.exe" = sProcess) {
postmessage, nMsg, uID, 0x0203, , ahk_id %hWnd%
}
}
DllCall("VirtualFreeEx", "Uint", hProc, "Uint", pRB, "Uint", 0, "Uint", 0x8000)
DllCall("CloseHandle", "Uint", hProc)
return
}
GetTrayBar()
{
WinGet, ControlList, ControlList, ahk_class Shell_TrayWnd
RegExMatch(ControlList, "(?<=ToolbarWindow32)\d+(?!.*ToolbarWindow32)", nTB)
loop, %nTB%
{
ControlGet, hWnd, hWnd,, ToolbarWindow32%A_Index%, ahk_class Shell_TrayWnd
hParent := DllCall("GetParent", "Uint", hWnd)
WinGetClass, sClass, ahk_id %hParent%
if (sClass <> "SysPager")
continue
idxTB := A_Index
break
}
return idxTB
} |
enjoy!
[ keywords ]
googletalk, gtalk, gmail, google, hide, unhide, systray, hotkey, shortcut, fast, bosskey _________________ [ profile | ahk.net | ahk.talk ] |
|