zoukankan      html  css  js  c++  java
  • How to get the text from any standard object

    The code below shows how you can get the text from any standard object without using text recognition.

    Standard Examples

    'Get text from a ListView - report style (for example, Windows Explorer)

    msgbox Window("C:\Program Files\Mercury").WinListView("SysListView32").GetSubItem(1,2)

    'Get text from a toolbar

    msgbox Window("C:\Program Files\Mercury").WinToolbar("ToolbarWindow32").GetItem(1)

    'Text of a message-box, the Static control is not in the object repository/shared object ' 'repository

    set StatObj = Dialog("DlgTB").Dialog("DlgTB").Static("nativeclass:=Static","Index:=1")

    msgbox StatObj.GetROProperty("text")

    Web Example

    ' An example for a Web Table (in the Mercury Tour site)

    Set Cell = Browser("Welcome: Mercury Tours").Page("Select a Flight: Mercury").WebTable("RETURN").ChildItem(3, 2, "WebElement", 0)

    Msgbox Cell.GetROProperty("innertext")

    Visual Basic Example

    'Retrieving the text of a label in a VB form: (There is no Test Object for a label)

    msgbox VbWindow("VBForm1").Object.Controls("Label1").caption

    .NET Example

    'Get the text of items in a CheckListBox (has no Test Object)

    'Get run-time object reference

    Set CustList = SwfWindow("Win").SwfObject(ìlst").Object

    'Get Items collection

    Set ListItems = CustList.get_Items()

    'Get Items count

    ItemsCount = ListItems.Count

    'Loop over all items

    For i = 0 to ItemsCount-1

           text = text & ListItems.Item(i)

    Next

    ActiveX Example

    ' This example will retrieve the text from the Visual Basic Flight 1A sample application's flight grid

    ' This retrieves the flight number from the 3rd row.

    VbWindow("VbWindow").VbWindow("VbWindow").AcxTable("Grid Control").Object.Row = 3

    VbWindow("VbWindow").VbWindow("VbWindow").AcxTable("Grid Control").Object.Col = 0

    msgbox VbWindow("VbWindow").VbWindow("VbWindow").AcxTable("Grid Control").Object.Text

  • 相关阅读:
    重新梳理HTML基础知识
    Bootstrap响应式栅格系统的设计原理
    php 循环爬虫 or 持久执行任务 总断掉服务 解决,flush(),ob_flush()的组合使用
    Linux中工作目录切换命令
    Linux中系统状态检测命令
    Linux系统中rm删除命令
    Linux中touch命令使用(创建文件)
    Linux中 mkdir 创建文件夹命令
    Linux 中 cp 命令(文件复制)
    Linux中 mv(文件移动)
  • 原文地址:https://www.cnblogs.com/emma/p/1682672.html
Copyright © 2011-2022 走看看