Jump to content

Get Text from Lync IM Client


Recommended Posts

I am trying to read the text of a Lync IM client and respond with predefined text strings. My script works getting the active window and sending text but does not read the text beforehand successfully. I have cut the script down to just getting text for troubleshooting. I can get it to return a "0" or "" depending on what line I use. See my comments in code.

#include <Array.au3>

Dim $num = 3

Dim $buddies[$num][2] = [["User1",0], ["User2",0], ["User3",0]]

$IMClassName="[CLASS:IMWindowClass]"

; Get all the active/minimized Lync windows

$winList = WinList($IMClassName)

For $a = 0 to $winList[0][0]

MsgBox(0, "WinList", $winList[$a][0]) ;Displays a number showing how many IM Windows were found and the Titles of Windows

; Activate Lync window if there is any

If WinActivate($winList[$a][0]) <> 0 Then

; Get title from IM

$title = WinGetTitle($winList[$a][0], "") ;Getting Titles of all IM Windows

$text = WinGetText("[CLASS:IMWindowClass]", "") ; Returns Blank

;$text = WinGetText("[CLASS:User1]", "") ;Returns a Zero

;$text = WinGetText($IMClassName) ;Returns Blank

; Loop thro all coworkers

For $r = 0 to UBound($coworkers) - 1

; Read Message text if name matches

If StringInStr($title, $buddies[$r][0])>0 And $buddies[$r][1]=0 Then

MsgBox(0, "Text read was:" , $text) ; Suppose to Display text if a match from array is found

EndIf

Next

ENdIf

Next

Exit

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