Wolfteeth Posted March 24, 2011 Posted March 24, 2011 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
Juvigy Posted March 24, 2011 Posted March 24, 2011 $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.
Wolfteeth Posted March 24, 2011 Author Posted March 24, 2011 $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.
Juvigy Posted March 24, 2011 Posted March 24, 2011 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]
Wolfteeth Posted March 25, 2011 Author Posted March 25, 2011 (edited) 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 March 25, 2011 by Wolfteeth
Juvigy Posted March 25, 2011 Posted March 25, 2011 That is what i mean - it seems this function is not exposed outside the VBA. In other words you cant access it with AutoIT. Maybe a DLL can be created to expose it but this is out of my expertise.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now