Jump to content

Office Communicator Conversation


Recommended Posts

Not sure if someone used the AutoIt to generate converation in Office communicator 2007, I have tried below code, which can already start a new conversation window, but I am not sure how to send text to the conversation window as I don't know how to dim the data type in AutoIt. attach below is the c# code from MSDN,

http://msdn.microsoft.com/en-us/library/bb787199(office.12).aspx

$oCommunicator = ObjCreate("Communicator.UIAutomation")
$s = $oCommunicator.Mycontacts
$m = $oCommunicator.GetContact("soneone@dumy.com", $oCommunicator.MyServiceID)
$rr = $oCommunicator.InstantMessage($m)

and below should be VBA code:

Sub sendMessage()
Dim p As CommunicatorAPI.Messenger
Dim r As CommunicatorAPI.IMessengerConversationWndAdvanced
Dim s As CommunicatorAPI.IMessengerContacts
Dim m As CommunicatorAPI.IMessengerContact
Dim w As String
Dim v As Long
v = 1
w = ""
Set p = CreateObject("Communicator.UIAutomation")
p.AutoSignin
Set s = p.MyContacts
Set m = p.GetContact("some@dummy.com",CStr(p.MyServiceId))
Set rr = p.InstantMessage(m)
r.SendText ("hello from VBA Excel. ignore")
End Sub
Link to comment
Share on other sites

$oCommunicator = ObjCreate("Communicator.UIAutomation")
$s = $oCommunicator.Mycontacts
$m = $oCommunicator.GetContact("test@hp.com", $oCommunicator.MyServiceID)
$rr = $oCommunicator.InstantMessage($m)
Send("asdasdasdasdasdasdasdasd")
Send("{ENTER}")

This works and should get you started.

Link to comment
Share on other sites

$oCommunicator = ObjCreate("Communicator.UIAutomation")
$s = $oCommunicator.Mycontacts
$m = $oCommunicator.GetContact("test@hp.com", $oCommunicator.MyServiceID)
$rr = $oCommunicator.InstantMessage($m)
Send("asdasdasdasdasdasdasdasd")
Send("{ENTER}")

This works and should get you started.

Dear, this is not a good script even it can DO, I still want to use COM object behaviour for target.

Link to comment
Share on other sites

I tried it via AutoIt but it doesnt work. I think it is because it is restricted:

IMessengerConversationWndAdvanced::SendText
Sends a text message to an open conversation window.
[b]Not scriptable.[/b]

No, the Excel VBA code did the trick, for you reference too.

Sub Communicator()
Dim msgr As CommunicatorAPI.IMessengerConversationWndAdvanced
Set msgr = CommunicatorAPI.InstantMessage("me@me.com")
msgr.SendText "hello world"
End Sub

however, I don't want to use Excel to be the mediummedia but want to have an exe file so that I can use many other function build in Autoit to do more things.

by the way, you should add the reference for CommunicatorAutomation UI in advance.

I think the problem is that don't know how to hook the interface (CommunicatorAPI.IMessengerConversationWndAdvanced).

Below is the info from Object Browser:

Class IMessengerConversationWndAdvanced

Member of CommunicatorAPI

Messenger Conversation Window Advanced Interface

Class Messenger

Member of CommunicatorAPI

Messenger Object

Edited by Wolfteeth
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...