GetMachineAgentType Function

Action

Returns the Silk Test agent type, Classic Agent or Open Agent, for the specified machine.

Syntax

sAgentType = GetMachineAgentType ([hMachine])
Variable Description
sAgentType The type of agent, Classic_Agent or Open_Agent, that the window declaration uses. STRING.
hMachine Optional: The handle to the machine whose Agent type you want. Default is the current machine. HMACHINE.

Notes

This function returns the name of the Silk Test agent that was used for the last agent call. For example, if you call NotepadOA.SetActive(), which uses the Open Agent, and then call GetMachineAgentType(), it returns Open Agent.

Certain functions and methods run on the Classic Agent only, such as the ClipboardClass methods. Calling GetMachineAgentType() after these functions always returns Classic Agent.

Example

[-] testcase TestGetMachineAgentType()
	[ ] // Use Classic Agent
	[ ] NotepadCA.SetActive()
	[ ] // GetMachineAgentType() defaults to Classic Agent
	[ ] Verify(GetMachineAgentType(), CLASSIC_AGENT)
	[ ]   
	[ ] // Use Open Agent
	[ ] NotepadOA.SetActive()
	[ ] // GetMachineAgentType defaults to Open Agent
	[ ] Verify(GetMachineAgentType(), OPEN_AGENT)
	[ ] 
	[ ] // Get Handles to both agents
	[ ] NotepadCA.SetActive()
	[ ] HANDLE hClassicMachine = GetMachine()
	[ ] NotepadOA.SetActive()
	[ ] HANDLE hOpenMachine = GetMachine()
	[ ] // Verify the handles
	[ ] Verify(GetMachineAgentType(hClassicMachine), CLASSIC_AGENT)
	[ ] Verify(GetMachineAgentType(hOpenMachine), OPEN_AGENT)