How to hide/show Messenger Plus! ‘contacts on desktop’ based on a hotkey

Earlier today, I’ve made another post doing something very similar to this one. You can have a look at it here.

We are going to do the exact same thing actually, but this time, you will be able to use the code that I’m giving without any modification.

So, without further ado, here is the AutoIt code:

HotKeySet("!h", "ShowHideFloatingContacts") ; ALT+h as the hotkey

AutoItSetOption("WinTitleMatchMode", 4)

While 1
    Sleep(100)
WEnd

Func ShowHideFloatingContacts()
$hWindows = WinList("[CLASS:#32770]")
For $i = 1 to $hWindows[0][0]
    $size= WinGetClientSize($hWindows[$i][1])

    If $size[1] = 23 Then
        $state = WinGetState($hWindows[$i][1], "")
        If Not BitAnd($state, 2) Then
        WinSetState($hWindows[$i][1], "", @SW_SHOW)
        Else
        WinSetState($hWindows[$i][1], "", @SW_HIDE)
        EndIf
    EndIf

Next

EndFunc

It works based on the fact that the height of these ‘contacts on desktop’, as far as I have observed, is always 23. You just can not make them longer. Well, I think by checking for this, it is a pretty unique way to identify these little windows.

If you don’t know how to use this code by utilizing AutoIt, check out my previous post.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: