AutoHotkey Community

It is currently May 26th, 2012, 9:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: Fastkey for GoogleTalk
PostPosted: July 17th, 2008, 11:12 pm 
Offline

Joined: July 21st, 2006, 12:26 am
Posts: 223
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 ]


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 21st, 2008, 2:03 pm 
Hey, thanks for the adaptation. I noticed that Google Talk is an application that tends to resist scripting. Masterfully done.


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Klark92 and 24 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group