Set Focus
Sets keyboard focus to a specific UI element.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Handle - The handle of the window containing the element.
- Window Selector - The selector for identifying the target window.
- Element Selector - The selector for identifying the target element.
How It Works
The Set Focus node sets keyboard focus to a specific UI element. When executed, the node:
- Uses the Window Selector and Element Selector to locate the target element
- Calls the SetFocus method on the element to give it keyboard focus
Requirements
- Both Window Selector and Element Selector are required to identify the target element
- The target element must be able to receive focus
Error Handling
The node will return specific errors in the following cases:
- Empty or invalid Window Selector or Element Selector
- Element not found
- Element cannot receive focus
Usage Notes
- Setting focus is often a prerequisite for sending keystrokes to an element
- Focused elements typically have a visual indicator (like a border or highlight)
- This node is useful when you need to ensure an element is ready to receive input
- Some elements automatically receive focus when clicked, but others may require explicit focus
- Focus can only be set on elements that are currently visible and enabled