Sign in to follow this  
Followers 0
jgq85

Newb - help with API?

11 posts in this topic

Hi, I'm not too familiar with API but I hear you can use it to interact with applications when creating scripts/programs.

Could someone please help me with a guide here or online somewhere that tells me how to work with API?

I'm interested in trying to see if "Microsoft Lync", a client messaging app, has an API but I don't know what files to look for and how to get started. 

How could I use API with Microsoft Lync and AutoIt to make an Instant Messaging program or auto-reply, etc.?

Sorry i am very new but willing to learn 

Share this post


Link to post
Share on other sites



It would be polite if you could link to the Lync API documentation.


_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_DotNet_Load()/_DotNet_Unload()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource()_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUIRegisterMsg()_GUISetIcon()_Icon_Clear()/_Icon_Set()_IdleTime()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsSystemDrive()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_Create_CTL_CODE()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingDirToHTML5FileInstallrFileReadLastChars()GeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIEventsGUIGetBkColor()Int_Parse() & Int_TryParse()IsISBN()LockFile()Mapping CtrlIDsOOP in AutoItParseHeadersToSciTE()PasswordValidPasteBinPosts Per DayPreExpandProtect GlobalsQueue()Resource UpdateResourcesExSciTE JumpSettings INISHELLHOOKShunting-YardSignature CreatorStack()Stopwatch()StringAddLF()/StringStripLF()StringEOLToCRLF()VSCROLLWM_COPYDATAMore Examples...

Updated: 04/09/2015

Share this post


Link to post
Share on other sites

I remember doing some stuff for the older version of Lync (2007?) just after it changed from Communicator. Here is one script I still have floating around, might be of some use to show you how it talked. Unfortunately, the customer I support now doesn't use Lync, so I haven't had a chance to update any of the scripts to see how much the SDK has changed.

 

Getting someone's status:

#include <GUIConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>

_statusIM()

While 1

Wend


Func _statusIM()
$oCommunicator = ObjCreate("Communicator.UIAutomation")
$m = $oCommunicator.GetContact("person@email.com", $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

When you're dead, you don't know you're dead - it's only difficult for those that know you. It's the same way when you're stupid...

My Scripts: SCCM UDFInclude Source with Compiled Script, Windows Firewall UDF

Share this post


Link to post
Share on other sites

 

I remember doing some stuff for the older version of Lync (2007?) just after it changed from Communicator. Here is one script I still have floating around, might be of some use to show you how it talked. Unfortunately, the customer I support now doesn't use Lync, so I haven't had a chance to update any of the scripts to see how much the SDK has changed.

 

Getting someone's status:

#include <GUIConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>

_statusIM()

While 1

Wend


Func _statusIM()
$oCommunicator = ObjCreate("Communicator.UIAutomation")
$m = $oCommunicator.GetContact("person@email.com", $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

Thanks I really appreciate the help.

Just so I'm not copying/pasting and moving on without learning anything, can you explain why the "$oCommunicator = ObjCreate("Communicator.UIAutomation")" and others work, without having to refer to a dll file or import a reference?

I'm on Lync 2010 but I think Communicator.UIAutimation works.

The Lync SDK is like 100 lines just to send one Instant Message in the C# language, so It's really daunting for a beginner to try and learn that, then translate into AutoIt, which you appear you have accomplished and fewer lines.

Share this post


Link to post
Share on other sites

Just so I'm not copying/pasting and moving on without learning anything, can you explain why the "$oCommunicator = ObjCreate("Communicator.UIAutomation")" and others work, without having to refer to a dll file or import a reference?

 

Look here

http://www.autoitscript.com/autoit3/docs/functions/ObjCreate.htm

http://www.autoitscript.com/autoit3/docs/intro/ComRef.htm

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

I guess what I'm trying to do is find where the Object exists in my system.

In the code it's  ObjCreate("Communicator.UIAutomation")

But I'm using OLE/COM Object Viewer, from C:Program Files (x86)Windows Kits8.0binx86

Because the download link in that ComRef.htm KB article is invalid, probably because it's a Windows 2000 resource kit download out of date. 

And I'm not sure where within Object Viewer the Communicator one is. There's no search feature unfortunately. 

Edited by jgq85

Share this post


Link to post
Share on other sites

For hours been searching "Communicator.UIAutomation" all over Google, have no idea where it comes from still.

Found some website in spanish that had a screenshot of the Registry, where I do show show it in 

HKEY_CLASSES_ROOTCommunicator.UIAutomation

Still not sure how/why AutoIt works or how you'd come to find out about Communicator.UIAutomation for ObjCreate

Share this post


Link to post
Share on other sites

ok, I think I found where it is in OLE/COM Object Viewer
 

Under Object Classes > Grouped by Component Category > Automation Objects > then "Office Communicator Messenger Class". 

Now the documentation and script example is starting to make sense (to me as a newb). 

As I Now see the "Communicator.UIAutomation" value for VersionIndependentProgID.

Verified presence of TypeLib

Then in ITypeInfoViewer, I see the GetContact information. Still a little confusing but at least I'm farther than where I was before. 

Share this post


Link to post
Share on other sites

 

I remember doing some stuff for the older version of Lync (2007?) just after it changed from Communicator. Here is one script I still have floating around, might be of some use to show you how it talked. Unfortunately, the customer I support now doesn't use Lync, so I haven't had a chance to update any of the scripts to see how much the SDK has changed.

 

Getting someone's status:

#include <GUIConstants.au3>
#include <ProgressConstants.au3>
#include <StaticConstants.au3>

_statusIM()

While 1

Wend


Func _statusIM()
$oCommunicator = ObjCreate("Communicator.UIAutomation")
$m = $oCommunicator.GetContact("person@email.com", $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

 

Did you refer here for the Status indications?
 
Or did you gather that info elsewhere?

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