Go Back   Grim Dawn Forums > Off Topic > Totally Random

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-19-2011, 06:18 PM
Renevent's Avatar
Renevent Renevent is offline
Lord Advocate
 
Join Date: Jan 2010
Location: Cary, NC
Posts: 4,038
Default Fun with Microsoft Office Communicator

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

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:



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.

Last edited by Renevent; 01-19-2011 at 07:03 PM.
Reply With Quote
  #2  
Old 01-19-2011, 06:30 PM
Malpheas's Avatar
Malpheas Malpheas is offline
Champion
 
Join Date: Jan 2010
Location: Alberta, Canada
Posts: 1,706
Default

Hmm, Turing test here we come.

Sneaky sneaky Ren.
__________________
Quote:
Originally Posted by medierra View Post
It may also be surprising to know that some players prefer different play-styles.
Quote:
Originally Posted by Void(null) View Post
Most of the games we enjoyed as youth and hold in such high regard as defining genres would now be classed as casual games and be sold in the app store or appear on facebook.
Reply With Quote
  #3  
Old 01-19-2011, 06:39 PM
Renevent's Avatar
Renevent Renevent is offline
Lord Advocate
 
Join Date: Jan 2010
Location: Cary, NC
Posts: 4,038
Default

Good luck, hope it works for you lol.
Reply With Quote
  #4  
Old 01-19-2011, 06:45 PM
Malpheas's Avatar
Malpheas Malpheas is offline
Champion
 
Join Date: Jan 2010
Location: Alberta, Canada
Posts: 1,706
Default

no no, I was saying that's what you did.. lol I have no interest in coming up with something like that.. :P
__________________
Quote:
Originally Posted by medierra View Post
It may also be surprising to know that some players prefer different play-styles.
Quote:
Originally Posted by Void(null) View Post
Most of the games we enjoyed as youth and hold in such high regard as defining genres would now be classed as casual games and be sold in the app store or appear on facebook.
Reply With Quote
  #5  
Old 01-19-2011, 07:31 PM
matthewfarmery matthewfarmery is offline
Champion
 
Join Date: Dec 2010
Posts: 2,854
Default

that going to be funny, yes the alicebot isn't bad at all, and certainly improved some over the years
__________________
Legendary key x2 holder since 20/12/2010 (a little late, but I have a key now ) and debit cards now work, yippee !!!!

Co-op Digital Deluxe Bundle I have upped my pledge to $200, to show my support to the devs and GD, I hope a few more people follow my lead and KS will be successful. I want this game so badly, and I want it to rock
Reply With Quote
  #6  
Old 05-01-2011, 01:51 AM
markg markg is offline
Initiate
 
Join Date: May 2011
Posts: 3
Default

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

Last edited by markg; 05-01-2011 at 10:23 AM.
Reply With Quote
  #7  
Old 06-03-2011, 07:46 PM
Renevent's Avatar
Renevent Renevent is offline
Lord Advocate
 
Join Date: Jan 2010
Location: Cary, NC
Posts: 4,038
Default

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:

Code:
Protected WithEvents communicator As New CommunicatorAPI.Messenger()
Now you can capture the windowcreated event:

Code:
   
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.

Code:
    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

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

Last edited by Renevent; 06-03-2011 at 07:49 PM.
Reply With Quote
  #8  
Old 06-04-2011, 01:51 PM
markg markg is offline
Initiate
 
Join Date: May 2011
Posts: 3
Default

Quote:
Originally Posted by Renevent View Post
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
You sir, are a gentleman!
Reply With Quote
  #9  
Old 07-19-2011, 10:58 AM
markg markg is offline
Initiate
 
Join Date: May 2011
Posts: 3
Default

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.
Reply With Quote
  #10  
Old 07-19-2011, 12:56 PM
Renevent's Avatar
Renevent Renevent is offline
Lord Advocate
 
Join Date: Jan 2010
Location: Cary, NC
Posts: 4,038
Default

Cool, good to know. Did you get everything else working ok?
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 01:02 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.