Constructs a new instance of HomElement.
The backend client used for communication.
The descriptor of the element.
The scope of the UI tree for the element.
Optional UI properties for the element.
Represents the bounding box of the UI.
If the UI is a window and is minimized, the Bounding box is 0.
Can use HomObject.updateCurrentBoundingBox to update boundingBox.
The children of the element.
If uiTreeScope set to Element, children will be empty.
Represents the control type of the UI.
A descriptor that represents the element of the UI.
Represents whether the UI has value pattern.
Can use HomObject.updateCurrentHasValue to update value.
A descriptor that represents the window to which the UI belongs, or indicates that the UI is a window itself.
The id of the UI.
Represents whether the UI has invoke pattern.
Can use HomObject.updateCurrentIsInvokable to update isInvokable.
Represents whether the UI has scroll pattern.
Can use HomObject.updateCurrentIsScrollable to update isScrollable.
Represents whether the UI is selected.
Represents the key of a UI element. The key is unique.
Represents the name of the UI
Can use HomObject.updateCurrentName to update name.
Represents the scrollable view of the UI.
If the UI has scroll pattern, can use HomObject.updateCurrentScrollableView to update the scrollable view. Otherwise, scrollableView is null.
Represents the toggle state of the UI.
Represents the value of the UI.
If the UI has value pattern, can using HomObject.updateCurrentValue to update the value. Otherwise, value is null.
Static Readonly ALLPROPERTYIDIf the UI has ExpandCollapse pattern, expand the UI.
(ExpandCollapse pattern related functions are not provided yet.)
UI does not support the ExpandCollapse pattern.
The UI result after calling expand() is roughly as follows.
(using file explorer as an example)

Finds a matching element in the UI tree based on a condition.
The condition to match.
The first matching element, or null if no match is found.
Finds all matching elements in the UI tree based on a condition.
The condition to match.
The matching elements.
Retrieves the audio buffer.
The callback function to handle the audio buffer data.
A promise that resolves when the audio buffer is retrieved.
// Before using setValue(), must first update updateCurrentHasValue() to confirm whether there is a value pattern
await homObject.getAudioBuffer((data: Buffer) => {
console.log('Received audio buffer:', data);
});
If the UI has invoke pattern, invoke the UI.
(can use HomObject.isInvokable to check UI supports the invoke pattern.)
UI does not support the invoke pattern.
// Before using invoke(), must first update updateCurrentIsInvokable() to confirm whether there is an invoke pattern
const isInvokable = await homObject.updateCurrentIsInvokable()
if (isInvokable) {
await homObject.invoke()
}
The UI result after calling invoke() is roughly as follows.
(using file explorer as an example)

If the UI has window pattern, restore the window.
(Window pattern related functions are not provided yet.)
UI does not support the window pattern.
The UI result after calling maximize() is roughly as follows.
(using file explorer as an example)

If the UI has window pattern, minimize the window.
(Window pattern related functions are not provided yet.)
UI does not support the window pattern.
The UI result after calling minimize() is roughly as follows.
(using file explorer as an example)

Moves the mouse into the UI center and click.
// Click the left mouse button into the UI center
await homObject.mouseClick()
// Click the right mouse button into the UI center
await homObject.mouseClick({ key: 'right' })
Moves the mouse into the UI center and Hold.
// Hold the left mouse button into the UI center
await homObject.mousePress()
// Hold the right mouse button into the UI center
// await homObject.mousePress({ key: 'right' })
Moves the mouse into the UI center and release.
// Hold the left mouse button into the UI center before release
await homObject.mousePress()
// Release the left mouse button into the UI center
await homObject.mouseRelease()
// Release the right mouse button into the UI center
// await homObject.mouseRelease({ key: 'right' })
Moves the mouse into the UI center and scroll down.
// Scroll down the mouse wheel into the UI center
await homObject.mouseScrollDown()
// Scroll down the mouse wheel into the UI center with 3 ticks
await homObject.mouseScrollDown({ tick: 3 })
// Scroll down the mouse wheel into the UI center with 120 amount
await homObject.mouseScrollDown({ amount: 120 })
Moves the mouse into the UI center and scroll up.
// Scroll up the mouse wheel into the UI center
await homObject.mouseScrollUp()
// Scroll up the mouse wheel into the UI center with 3 ticks
await homObject.mouseScrollUp({ tick: 3 })
// Scroll up the mouse wheel into the UI center with 120 amount
await homObject.mouseScrollUp({ amount: 120 })
If the UI has scroll pattern, scroll the UI horizontally.
(can use HomObject.isScrollable to check UI supports the scroll pattern.)
The amount to scroll horizontally.
UI does not support the scroll pattern.
// Before using scrollHorizontal(), must first update updateCurrentIsScrollable() to confirm whether there is a scroll pattern
const isScrollable = await homObject.updateCurrentIsScrollable()
if (isScrollable) {
await homObject.scrollHorizontal(Amount.LargeDecrement)
}
The UI result after calling scrollHorizontal() is roughly as follows.
(using file explorer as an example)

If the UI has ScrollItem pattern, Scrolls the element into view in the UI. (ScrollItem pattern related functions are not provided yet.)
UI does not support the ScrollItem pattern.
await element.scrollIntoView()
The UI result after calling scrollIntoView() is roughly as follows.
(using photo viewer as an example)

If the UI has scroll pattern, scroll the UI vertically.
(can use HomObject.isScrollable to check UI supports the scroll pattern.)
The amount to scroll vertically.
UI does not support the scroll pattern.
// Before using scrollVertical(), must first update updateCurrentIsScrollable() to confirm whether there is a scroll pattern
const isScrollable = await homObject.updateCurrentIsScrollable()
if (isScrollable) {
await homObject.scrollVertical(Amount.LargeDecrement)
}
The UI result after calling scrollVertical() is roughly as follows.
(using file explorer as an example)

If the UI has SelectionItem pattern, selects the UI.
(SelectionItem pattern related functions are not provided yet.)
UI does not support the SelectionItem pattern.
await file1.select()
await file2.select()
await file3.select()
The UI result after calling select() is roughly as follows.
(using file explorer as an example)

If the UI has SelectionItem pattern, selects the UI and unselects all other selected UIs.
(SelectionItem pattern related functions are not provided yet.)
UI does not support the SelectionItem pattern.
await file1.select()
await file2.select()
await file3.select()
// only file2 is selected
await file2.selectOnly()
The UI result after calling selectOnly() is roughly as follows.
(using file explorer as an example)

Asynchronously invokes the horizontal scrolling action.
(can use HomObject.isScrollable to check UI supports the scroll pattern.)
Set the percentage of horizontal scrolling.
UI does not support the scroll pattern.
// Before using setHorizontalScrollPercent(), must first update updateCurrentIsScrollable() to confirm whether there is a scroll pattern
const isScrollable = await homObject.updateCurrentIsScrollable()
if (isScrollable) {
await homObject.setHorizontalScrollPercent(50)
}
The UI result after calling setHorizontalScrollPercent() is roughly as follows.
(using file explorer as an example)

If the UI has RangeValue pattern, set value range of the UI. (RangeValue pattern related functions are not provided yet.)
UI does not support the RangeValue pattern.
await element.setRangeValue(565)
The UI result after calling setRangeValue() is roughly as follows.
(using photo viewer as an example)

If the UI has value pattern, set the value of the UI.
(can use HomObject.hasValue to check UI supports the value pattern.)
Value used to set the UI.
UI does not support the value pattern.
// Before using setValue(), must first update updateCurrentHasValue() to confirm whether there is a value pattern
const hasValue = await homObject.updateCurrentHasValue()
if (hasValue) {
await homObject.setValue('scrollV')
}
The UI result after calling setValue() is roughly as follows.
(using file explorer as an example)

Asynchronously invokes the vertical scrolling action.
(can use HomObject.isScrollable to check UI supports the scroll pattern.)
Set the percentage of vertical scrolling.
UI does not support the scroll pattern.
// Before using setVerticalScrollPercent(), must first update updateCurrentIsScrollable() to confirm whether there is a scroll pattern
const isScrollable = await homObject.updateCurrentIsScrollable()
if (isScrollable) {
await homObject.setVerticalScrollPercent(50)
}
The UI result after calling setVerticalScrollPercent() is roughly as follows.
(using file explorer as an example)

Starts the audio listening.
Optional channel: numberchannelRate, defaults to 1
Optional sampleRate: numbersampleRate, defaults to 44100
Optional bits: numberbits, defaults to 16
A promise that resolves when the audio listening is started.
// Before using setValue(), must first update updateCurrentHasValue() to confirm whether there is a value pattern
await homObject.startAudioListening()
// or with specific parameters
await homObject.startAudioListening(2)
await homObject.startAudioListening(2, 16000)
await homObject.startAudioListening(2, 16000, 8)
Traverse the UI tree recursively and execute a callback on each node.
The function to execute on each node.
If the UI has window pattern, restore the window.
(Window pattern related functions are not provided yet.)
UI does not support the window pattern.
The UI result after calling unMaximize() is roughly as follows.
(using file explorer as an example)

If the UI has SelectionItem pattern, unselects the UI.
(SelectionItem pattern related functions are not provided yet.)
UI does not support the SelectionItem pattern.
await file3.unSelect()
await file2.unSelect()
await file1.unSelect()
The UI result after calling unSelect() is roughly as follows.
(using file explorer as an example)

Updates the current bounding box property of the UI, this will update HomObject.boundingBox property.
A promise that resolves to the updated bounding box property.
const boundingBox = await homObject.updateCurrentBoundingBox()
// a new homObject.boundingBox property
console.log(boundingBox)
Updates the current hasValue property of the UI, this will update HomObject.hasValue property.
A promise that resolves to the updated hasValue property.
const hasValue = await homObject.updateCurrentHasValue()
// a new homObject.hasValue property
console.log(hasValue)
// homObject.hasValue property can be used to check if the UI has value pattern.
if (hasValue) {
// setValue() only works if the UI has value pattern.
homObject.setValue('new value')
}
Updates the current isInvokable property of the UI, this will update HomObject.isInvokable property.
A promise that resolves to the updated isInvokable property.
const isInvokable = await homObject.updateCurrentIsInvokable()
// a new homObject.isInvokable property
console.log(isInvokable)
// homObject.isInvokable property can be used to check if the UI has invoke pattern.
if (isInvokable) {
// invoke() only works if the UI has invoke pattern.
homObject.invoke()
}
Updates the current isScrollable property of the UI, this will update HomObject.isScrollable property.
A promise that resolves to the updated isScrollable property.
const isScrollable = await homObject.updateCurrentIsScrollable()
// a new homObject.isScrollable property
console.log(isScrollable)
// homObject.isScrollable property can be used to check if the UI has scroll pattern.
if (isScrollable) {
// scrollVertical() only works if the UI has scroll pattern.
homObject.scrollVertical(Amount.LargeDecrement)
}
Updates the current name property of the UI, this will update HomObject.name property.
A promise that resolves to the updated name property.
const name = await homObject.updateCurrentName()
// a new homObject.name property
console.log(name)
If the UI has scroll pattern, updates the current scrollableView property, otherwise, it will throw an error.
this will update HomObject.scrollableView property.
A promise that resolves to the updated scrollableView property.
Can use HomObject.isScrollable to check if the UI supports the scroll pattern.
// Before using updateCurrentScrollableView(), must first update updateCurrentIsScrollable() to confirm whether there is a scroll pattern
const isScrollable = await homObject.updateCurrentIsScrollable()
if (isScrollable) {
const scrollableView = await homObject.updateCurrentScrollableView()
// a new homObject.scrollableView property
console.log(scrollableView)
}
UI does not support the scroll pattern.
If the UI has value pattern, updates the current value property, otherwise, it will throw an error.
this will update HomObject.value property.
A promise that resolves to the updated value property.
Can use HomObject.hasValue to check if the UI supports the value pattern.
// Before using updateCurrentValue(), must first update updateCurrentHasValue() to confirm whether there is a value pattern
const hasValue = await homObject.updateCurrentHasValue()
if (hasValue) {
const value = await homObject.updateCurrentValue()
// a new homObject.value property
console.log(value)
}
UI does not support the value pattern.
Represents an element within the Host Object Model.