Execute button inside a ribbon

I want to write a script (C# or AutoIT or VBScript.. whatever works) which should

  • Get reference of already open outlook application

  • Iterate through ribbons to find a specific button

  • Execute that button click

  • How can I do it?


    Use AutomationPeers.

    Here is the MSDN article with lots of details: http://msdn.microsoft.com/en-us/library/ms752331.aspx

    Add references to:

  • UIAutomationClient
  • UIAutomationClientsideProviders
  • UIAutomationProvider
  • UIAutomationTypes
  • And here is a little C# code snippet of how to get the AutomationId of what currently has focus:

    var id = AutomationElement.FocusedElement.Current.AutomationId;
    this.txt.Text = id;
    

    You can navigate the entire tree of a window and drive the entire UI using automation peers. This is how accessibility applications interact with applications in Windows. This is also one way that automated UI testing applications do it as well.

    链接地址: http://www.djcxy.com/p/53510.html

    上一篇: 设置XCode 4工作区为Mac和iOS构建库

    下一篇: 在功能区内执行按钮