Jump to content

Newb - help with API?


Recommended Posts

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 

Link to comment
Share on other sites

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

UDF List:

 
_AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_ArrayFilter/_ArrayReduce_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: 22/04/2018

Link to comment
Share on other sites

  • Moderators

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

"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

  • 2 weeks later...

 

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.

Link to comment
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

Link to comment
Share on other sites

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
Link to comment
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

Link to comment
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. 

Link to comment
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?
Link to comment
Share on other sites

  • Moderators

It was for 2007 at the time, of course, but I use this: http://msdn.microsoft.com/en-us/library/office/jj937254(v=office.15).aspx

"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

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