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 

Fastkey for GoogleTalk

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
k3ph



Joined: 20 Jul 2006
Posts: 174

PostPosted: Thu Jul 17, 2008 10:12 pm    Post subject: Fastkey for GoogleTalk Reply with quote

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 ]
Back to top
View user's profile Send private message
Excellent
Guest





PostPosted: Mon Jul 21, 2008 1:03 pm    Post subject: Reply with quote

Hey, thanks for the adaptation. I noticed that Google Talk is an application that tends to resist scripting. Masterfully done.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions 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