PDA

View Full Version : Fun with Microsoft Office Communicator


Renevent
01-19-2011, 06:18 PM
So was bored at work yesterday and someone said something that gave me an idea...basically wouldn't it be nice if our office communicators could talk by themselves?

They are help desk guys so I decided to help them out :p

I used an AI bot from:

http://www.alicebot.org/directory.html

...then integrated into an application and wrote some .net code that hijacks incoming MS Communicator Messages, takes the incoming instant message and parses it out to the AI bot, then returns it back to the message window and submits it.

The AI bot is pretty smart, and people could pretty much go on talking with it for a while thinking you are just being a bit weird lol.

I threw it together quick though so a couple things...it's really only meant for incoming chatter (while you are either away or doing something else) so if you start the conversation make sure it's "stopped", send the IM, then quickly close the IM window and click "start" on the program. When they reply a new IM window will pop the the application will take over.

You can see all the chat history in the application's log...it's pretty humorous when you get folks talking to it lol.

Anyways, if any of you want to mess around with it you can download it here:

http://www.mediafire.com/?hvg2s476fzcj4u1

I think the only requirements are Windows XP (or higher), .Net 3.5, and of course Office Communicator 2007/2010.

Here's a pic:

http://img573.imageshack.us/img573/2342/virtualit.png

All the marked out names are incoming IM's from my friend in IT, and all the (Me) responses are generated by the AI bot.

Malpheas
01-19-2011, 06:30 PM
Hmm, Turing test here we come.

Sneaky sneaky Ren.

Renevent
01-19-2011, 06:39 PM
Good luck, hope it works for you lol.

Malpheas
01-19-2011, 06:45 PM
no no, I was saying that's what you did.. lol I have no interest in coming up with something like that.. :P

matthewfarmery
01-19-2011, 07:31 PM
that going to be funny, yes the alicebot isn't bad at all, and certainly improved some over the years

markg
05-01-2011, 01:51 AM
Very nice work!
I'm working on a similar C# project of automating Office Communicator responses. I'm almost there, but I'm having problems capturing received messages. There's no such event according to the MOC SDK documentation (OCSDK.chm). I'm wondering how you did it... (did you perhaps use the UccApi.dll api?). I would greatly appreciate your help, or if you are willing the sourcecode of your project.

Kind regards,
Mark

Renevent
06-03-2011, 07:46 PM
Sorry I didn't get back to you sooner I missed your reply...anyways yeah it's a pain in the ass to capture the incoming messages. Not sure if there is a more elegant way to do it, but here is how I was able to:

First you need to add the communicator object at the class level and make sure you declare it with events:


Protected WithEvents communicator As New CommunicatorAPI.Messenger()


Now you can capture the windowcreated event:


Private Sub communicator_OnIMWindowCreated(ByVal pIMWindow As CommunicatorAPI.IMessengerConversationWndAdvanced) Handles communicator.OnIMWindowCreated

objWindow = pIMWindow

End Sub

The problem I found is the message text isn't populated at the time of the event firing, so you have to wait outside the thread. I used a timer tick and when the text was actually populated then I was able to scrape the window.


Private Sub Timer1_Tick(ByVal sender As Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim strInput As String

Try

If Not objWindow Is Nothing Then
If Not objWindow.History Is Nothing Then

strInput = ParseIMMessage(objWindow.History)

Dim strOutput As String = Chat(strInput)

System.Threading.Thread.Sleep(4000)

objWindow.SendText(strOutput)

objWindow.Close()

txtLog.Text = Now.ToString("h:mm tt") & " (Me) " & strOutput & vbCrLf & txtLog.Text

End If
End If

Catch ex As Exception
End Try

End Sub


Anyways I uploaded the entire source so you can take a look at the full project.

Hope this helps :D

http://www.mediafire.com/?vd1uy091n07if6d

markg
06-04-2011, 01:51 PM
Sorry I didn't get back to you sooner I missed your reply...anyways yeah it's a pain in the ass to capture the incoming messages. Not sure if there is a more elegant way to do it, but here is how I was able to... Anyways I uploaded the entire source so you can take a look at the full project.

Hope this helps :D


You sir, are a gentleman! :)

markg
07-19-2011, 10:58 AM
For you interest;

On Windows 2003 Server, the Office Communicator application using Microsoft.mshtml generates the following event (see event log);

EventType clr20r3, P1 myapplication.exe, P2 1.0.0.0, P3 4e254c9d, P4 mscorlib, P5 2.0.0.0, P6 4d352e63, P7 13a2, P8 7, P9 system.io.filenotfoundexception, P10 NIL.

That's because the server requires the (for some reason missing) Microsoft Primary Interoperability Assemblies 2005. Installing C:\Program Files\Common Files\Merge Modules\vs_piaredist.exe resolves the issue.

Renevent
07-19-2011, 12:56 PM
Cool, good to know. Did you get everything else working ok?

runtpacket
03-31-2012, 07:35 PM
the files no longer exist on mediafire if you still have them can you re upload to another hosting service I would like to play with this. thanks