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 }
$i++
}
}
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.
1Because 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 – 2013-02-13T20:11:50.987
1NOTE: this SDK solution will only work with Lync for Windows. There is no SDK for Lync for Mac. – HairOfTheDog – 2013-02-13T20:12:24.963