Attach Method

Class

Agent.

Action

Attaches to the given application. Enables you to specify an additional command-line pattern and tech domain.

Syntax

C#
Attach (executablePattern, commandLinePattern, techDomains)
VB
Attach (executablePattern, commandLinePattern, techDomains)
Variable Description
executablePattern The executable name of the application. The pattern may include the wildcards '?' and '*' which match one or none to many characters respectively. For example myApplication.exe, myApplica?ion.exe, and myApp*.exe. String.
commandLinePattern Optional: This pattern is matched against the command line arguments of the application. This is useful when multiple instances of an application are running, but only some of them should be tested. For Java applications, the command line pattern could include the name of a characteristic jar or the main class, for example *org.MyMainClass. You can use "" to specify no command line pattern when you want to load specific tech domains. String.
techDomains Optional: The tech domains to load in the application. Typically, this parameter is only used by technical support. As a best practice, do not specify a tech domain. If you do not specify a tech domain, all available tech domains are loaded. TechDomain.

Examples

The following example attaches to the Notepad application.

Agent.Attach("notepad.exe")              

The following example shows how to use the command-line pattern to attach to a specific instance of a process when multiple instances of the application are running.

Agent.Attach("javaw.exe", “*org.MyMainClass”) 
The following example shows how to attach to Internet Explorer and load the Win32 tech domain:
Agent.Attach("iexplore.exe", "", {"WIN32"})