I've just upgraded to Lync 2013, and I'm considering using it instead of Pidgin+SIPE. One of Pidgin's many nice features is Growl integration... and I would miss that.

There are no Growl plugins for Lync and none in the works, but I don't really need that... I've already discovered how to issue Growl notices from a shell script, and all I would need is the hook into Lync to fire off a bat file (or perhaps Powershell). Is there any way to jigger or connive this into being?

The Microsoft Lync SDK documentation makes it seem like it might be possible, but it sounds like gobbledegook to me. Can anyone help me get started, or at least rule out scripting as a possibility?


Judging from this and this, my course of action would be to write some code that calls an external executable and passes arguments also (powershell.exe for example), and tie it to the IM Received event, if such an event exists, I'm downloading the sdk now so I'll update w/ what I find. But this way, you're not limited to what happens when an IM is received.

| improve this answer | |
  • 1
    Because you will already be writing code to hok into the IM received event you could bypass the shell script and write directly to the Growl API. – HairOfTheDog Feb 13 '13 at 20:11
  • 1
    NOTE: this SDK solution will only work with Lync for Windows. There is no SDK for Lync for Mac. – HairOfTheDog Feb 13 '13 at 20:12

A Powershell script can hook into Lync events, if the Lync SDK is installed (in particular a dll called Microsoft.Lync.Model.Dll.

You'd import it with a statement like this:

import-module "C:\Program Files (x86)\Microsoft Lync\SDK\Assemblies\Desktop\Microsoft.Lync.Model.Dll"

Then you'd get the client object like this:

$client = [Microsoft.Lync.Model.LyncClient]::GetClient()

Finally, you'd need to hook into the events that you wanted to act on:

$i = 0
# For each conversation
foreach ($con in $client.ConversationManager.Conversations) {
  # For each participant in the conversation
  $con.Participants | Where { !$_.IsSelf } | foreach {
    Register-ObjectEvent -InputObject $_.Modalities[1] -EventName "InstantMessageReceived" -SourceIdentifier "person $i" -action { newInstantMessage }

Each conversation object (open IM window/tab) has at least two participants (sometimes) more, the above code checks each of those conversations and each participant in them but ignores the participant that is "you" (IsSelf). This code then fires off the newInstantMessage function every time someone sends you a message.

Most importantly, you need something at the end of the powershell script to keep it from exiting, while(1) {} is sufficient. Finally, you might want to also hook the ConversationAdded event and inside that register new InstantMessageReceived events. Otherwise it will only work for existing conversations.

For those that aren't interested in the hows and whys, I intend to make my script available publicly in the near future. Check the Growl For Windows website.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.