BindAgentOption Function

Action

Sets a new value for the specified agent option within a recording block or withoptions statement and returns the previous value.

Syntax

aOldValue = BindAgentOption (aoAgentOption, aNewValue)
Variable Description
aOldValue Previous value of the Agent option. The data type depends on the option. ANYTYPE.
aoAgentOption Name of an agent option as specified by one of the constants defined for the AGENTOPTION enumerated data type.
aNewValue Value to which to set the specified agent option. ANYTYPE.

Notes

BindAgentOption is useful when an agent option needs to be set to a particular value only for the duration of a given call. It obviates the need to get the previous value, set up a do...except statement, and so on.

BindAgentOption must be called within a recording block or a withoptions block. The value you specify overrides the value specified in the Agent Options dialog box. 4Test saves the old value of the agent option and restores it when the block is exited.

BindAgentOption uses seconds as its time unit, as does Agent.SetOption.

Example

[-] testcase Test2() appstate none
	[ ] TestApplication.SetActive() 
	[ ] withoptions 
	[ ] // slow down the mouse and keyboard 
	[ ] BindAgentOption(OPT_KEYBOARD_DELAY, .5)
	[ ] BindAgentOption(OPT_MOUSE_DELAY, .5)
	[ ] TestApplication.Control.CheckBox.Pick() 
	[ ] xCheckBox.TheCheckBox.Check() 
	[ ] xCheckBox.TheCheckBox.Uncheck() 
	[ ] xCheckBox.TheCheckBox.Check() 
	[ ] xCheckBox.Close()
	[ ] 
	[ ] // back to my usual settings, outside withoptions 
	[ ] TestApplication.Control.CheckBox.Pick()
	[ ] xCheckBox.TheCheckBox.Check() 
	[ ] xCheckBox.TheCheckBox.Uncheck()
	[ ] xCheckBox.TheCheckBox.Check()
	[ ] xCheckBox.Close()