Sign in to follow this  
Followers 0
jcpetu

IMessenger Object question

6 posts in this topic

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.

Global $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.

Share this post


Link to post
Share on other sites



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

You are using the Switch as a Select :sweating: 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 by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#4 ·  Posted (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 by JLogan3o13

√-1 2^3 ∑ π, and it was delicious!

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0