Obtaining SysLink Link Properties in Desktop Windows Applications

Applies to TestComplete 15.70, last modified on December 17, 2024

While testing SysLink controls, you can use specific properties and methods of the corresponding program object to perform certain actions and obtain data stored in controls. You can call these methods and properties from your keyword tests, as well as from scripts. This topic describes how to work with the needed properties and methods from your scripts. However, when testing a control from your keyword test, you can use the same methods and properties calling them from keyword test operations. For more information, see Keyword Tests Basic Operations.

To obtain the properties of a link contained in a standard SysLink control, use the Link property of the Win32SysLink object. TestComplete associates this object with all SysLink controls whose class names are listed in the Object Mapping options of your project.

The SysLink control can contain several links. To obtain the total number of links the control contains, use the LinkCount property of the Win32SysLink object. For more information, see the Obtaining the Number of Links in SysLink Controls in Desktop Windows Applications topic.

The Link property has one parameter that specifies the index of the link. This property returns the Win32SysLinkItem object. This object corresponds to the link specified by its index and provides a scripting interface for this link. You can obtain the link’s properties using the ID, Url and Visited properties of the Win32SysLinkItem object.

The following example demonstrates how you can get the properties of a link stored in the SysLink control located on the About Windows window (to invoke this window, select Help | About Windows from the main menu of the Windows Explorer):

JavaScript, JScript

function main()
{
  var SysLink, SysLinkItem;
    
  // Obtain the SysLink control
  SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1);
  
  // Obtain the SysLinkItem object that provides a scripting interface for the link
  SysLinkItem = SysLink.Link(0)
  
  // Get the link's properties
  Log.Message (SysLinkItem.ID);
  Log.Message (SysLinkItem.Url);
  Log.Message (SysLinkItem.Visited);
}

Python

def Main():
    
  # Obtain the SysLink control
  SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1)
  
  # Obtain the SysLinkItem object that provides a scripting interface for the link 
  SysLinkItem = SysLink.Link(0)
  
  # Get the link's properties
  Log.Message (SysLinkItem.ID) 
  Log.Message (SysLinkItem.Url)
  Log.Message (SysLinkItem.Visited)

VBScript

Sub main
  Dim SysLink, SysLinkItem
    
  ' Obtain the SysLink control
  Set SysLink = Sys.Process("Explorer").Window("#32770", "About Windows", 1).Window("SysLink", "", 1)
  
  ' Obtain the SysLinkItem object that provides a scripting interface for the link
  Set SysLinkItem = SysLink.Link(0)
  
  ' Get the link's properties
  Log.Message SysLinkItem.ID
  Log.Message SysLinkItem.Url
  Log.Message SysLinkItem.Visited
End Sub

DelphiScript

procedure main;
var SysLink, SysLinkItem;
begin

  // Obtain the SysLink control
  SysLink := Sys.Process('Explorer').Window('#32770', 'About Windows', 1).Window('SysLink', '', 1);
  
  // Obtain the SysLinkItem object that provides a scripting interface for the link
  SysLinkItem := SysLink.Link(0);
  
  // Get the link's properties
  Log.Message (SysLinkItem.ID);
  Log.Message (SysLinkItem.Url);
  Log.Message (SysLinkItem.Visited);
end;

C++Script, C#Script

function main()
{
  var SysLink, SysLinkItem;
    
  // Obtain the SysLink control
  SysLink = Sys["Process"]("Explorer")["Window"]("#32770", "About Windows", 1)["Window"]("SysLink", "", 1);
  
  // Obtain the SysLinkItem object that provides a scripting interface for the link
  SysLinkItem = SysLink["Link"](0);
  
  // Get the link's properties
  Log.Message (SysLinkItem["ID"]);
  Log.Message (SysLinkItem["Url"]);
  Log.Message (SysLinkItem["Visited"]);
}

See Also

Working With SysLink Controls in Desktop Windows Applications
Link Property (SysLink Controls)
LinkCount Property (SysLink Controls)
Win32SysLinkItem Object
ID Property (SysLinkItem Objects)
Url Property (SysLinkItem Objects)
Visited Property (SysLinkItem Objects)

Highlight search results