jcpetu Posted April 23, 2013 Share Posted April 23, 2013 Hello forum, I´m trying to get basic information from local IM (Microsoft communicator) but IM status, for example, is allways returning the same value independently of the real status. Here is the code is anyone could help me. expandcollapse popupGlobal $MISTATUS_UNKNOWN = 0x0000 Global $MISTATUS_OFFLINE = 0x0001 Global $MISTATUS_ONLINE = 0x0002 Global $MISTATUS_INVISIBLE = 0x0006 Global $MISTATUS_BUSY = 0x000A Global $MISTATUS_BE_RIGHT_BACK = 0x000E Global $MISTATUS_IDLE = 0x0012 Global $MISTATUS_AWAY = 0x0022 Global $MISTATUS_ON_THE_PHONE = 0x0032 Global $MISTATUS_OUT_TO_LUNCH = 0x0042 Global $MISTATUS_IN_A_MEETING = 0x0052 Global $MISTATUS_OUT_OF_OFFICE = 0x0062 Global $MISTATUS_DO_NOT_DISTURB = 0x0072 Global $MISTATUS_IN_A_CONFERENCE = 0x0082 Global $MISTATUS_ALLOW_URGENT_INTERRUPTIONS = 0x0092 Global $MISTATUS_MAY_BE_AVAILABLE = 0x00A2 Global $MISTATUS_CUSTOM = 0x00B2 Global $MISTATUS_LOCAL_FINDING_SERVER = 0x0100 Global $MISTATUS_LOCAL_CONNECTING_TO_SERVER = 0x0200 Global $MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300 Global $MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400 $oCommunicator = ObjCreate("Communicator.UIAutomation") $MyName = $oCommunicator.MyFriendlyName $MyeMail = $oCommunicator.MySigninName $MyStatus = $oCommunicator.MyStatus ConsoleWrite("Name=" & $MyName & @CRLF& "e-mail=" & $MyeMail & @CRLF) Switch $MyStatus Case $MISTATUS_UNKNOWN ConsoleWrite("Presence unknown" & @CRLF) Case $MISTATUS_OFFLINE = 0x0001 ConsoleWrite("Offline" & @CRLF) Case $MISTATUS_ONLINE = 0x0002 ConsoleWrite("Presence unknown" & @CRLF) Case $MISTATUS_INVISIBLE = 0x0006 ConsoleWrite("Invisible" & @CRLF) Case $MISTATUS_BUSY = 0x000A ConsoleWrite("Busy" & @CRLF) Case $MISTATUS_BE_RIGHT_BACK = 0x000E ConsoleWrite("Be Right back" & @CRLF) Case $MISTATUS_IDLE = 0x0012 ConsoleWrite("Idle" & @CRLF) Case $MISTATUS_AWAY = 0x0022 ConsoleWrite("Away" & @CRLF) Case $MISTATUS_ON_THE_PHONE = 0x0032 ConsoleWrite("On the phone" & @CRLF) Case $MISTATUS_OUT_TO_LUNCH = 0x0042 ConsoleWrite("Out to lunch" & @CRLF) Case $MISTATUS_IN_A_MEETING = 0x0052 ConsoleWrite("In a meeting" & @CRLF) Case $MISTATUS_OUT_OF_OFFICE = 0x0062 ConsoleWrite("Out of office" & @CRLF) Case $MISTATUS_DO_NOT_DISTURB = 0x0072 ConsoleWrite("Do not disturb" & @CRLF) Case $MISTATUS_IN_A_CONFERENCE = 0x0082 ConsoleWrite("In a conference" & @CRLF) Case $MISTATUS_ALLOW_URGENT_INTERRUPTIONS = 0x0092 ConsoleWrite("Allow urgent interruptions" & @CRLF) Case $MISTATUS_MAY_BE_AVAILABLE = 0x00A2 ConsoleWrite("May be available" & @CRLF) Case $MISTATUS_CUSTOM = 0x00B2 ConsoleWrite("Custom" & @CRLF) Case $MISTATUS_LOCAL_FINDING_SERVER = 0x0100 ConsoleWrite("Finding server" & @CRLF) Case $MISTATUS_LOCAL_CONNECTING_TO_SERVER = 0x0200 ConsoleWrite("Connecting to server" & @CRLF) Case $MISTATUS_LOCAL_SYNCHRONIZING_WITH_SERVER = 0x0300 ConsoleWrite("Synchronizing with server" & @CRLF) Case $MISTATUS_LOCAL_DISCONNECTING_FROM_SERVER = 0x0400 ConsoleWrite("Disconnecting from server" & @CRLF) Case Else ConsoleWrite("Unknown" & @CRLF) EndSwitch thanks a lot. Link to comment Share on other sites More sharing options...
water Posted April 23, 2013 Share Posted April 23, 2013 If you search the forum for "Communicator UIAutomation" you will find a few hits. Maybe a good starting point. My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsOutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiPowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - WikiTask Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki Standard UDFs:Excel - Example Scripts - WikiWord - Wiki Tutorials:ADO - WikiWebDriver - Wiki Link to comment Share on other sites More sharing options...
FireFox Posted April 23, 2013 Share Posted April 23, 2013 (edited) Hi, You are using the Switch as a Select as you are checking for the constant var with its value so it will always be equal to 1. Switch $MyStatus Case $MISTATUS_UNKNOWN ;OK ConsoleWrite("Presence unknown" & @CRLF) Case $MISTATUS_OFFLINE = 0x0001 ;bad Case $MISTATUS_OFFLINE ;<<OK Br, FireFox. Edited April 23, 2013 by FireFox Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted April 23, 2013 Moderators Share Posted April 23, 2013 (edited) Are you trying to get the status of a single person? If so, this is what I use for both Communicator 2007 and Lync 2010: #include <GUIConstants.au3> #include <ProgressConstants.au3> #include <StaticConstants.au3> Func _statusIM() $oCommunicator = ObjCreate("Communicator.UIAutomation") $m = $oCommunicator.GetContact("<email address for user>", $oCommunicator.MyServiceID) $statusName = _GetStatusName($m.Status()) msgbox(0,"",$statusName) EndFunc func _GetStatusName($var) Switch $var Case 0 return "UNKNOWN" Case 1 return "OFFLINE" Case 2 return "ONLINE" Case 10 return "BUSY" Case 18 return "INACTIVE" Case 34 return "AWAY" EndSwitch EndFunc Edited April 23, 2013 by JLogan3o13 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
jcpetu Posted April 23, 2013 Author Share Posted April 23, 2013 FireFox, Oh yes, you right. I just copypaste and forgot to erase the equal. Now it is working well. I´m sorry for the silly question. Thanks alot and regards. Link to comment Share on other sites More sharing options...
jcpetu Posted April 23, 2013 Author Share Posted April 23, 2013 JLogan3o13, yes I'm trying to get the status of a single person. But it is solved now with FireFox advice. Thanks a lot for your help. Link to comment Share on other sites More sharing options...
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