> ## Documentation Index
> Fetch the complete documentation index at: https://docs.simular.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Instance

> Represents an opened application instance.

## Constructor

```typescript
Instance(): Instance
```

### Returns

`Instance`

## Properties

<ResponseField name={"pid"} type={"number"} required>
  Get the process ID of the opened application (returns 0 when unknown).
</ResponseField>

## Methods

### content()

```typescript
content(): string
```

#### Returns

`string`

### disableAccessibility()

```typescript
disableAccessibility(): void
```

Disable the accessibility tree for the instance.

Creating the accessibility tree is resource-intensive, so many
applications disable it by default. After we are done controlling the
instance, we should disable the accessibility tree to save resources.

### enableAccessibility()

```typescript
enableAccessibility(): void
```

Enables the accessibility tree for the instance.

This also works when the application is already running.

### focus()

```typescript
focus(): boolean
```

Brings the instance to the foreground and gives it focus.

#### Returns

`boolean`

### hide()

```typescript
hide(): boolean
```

Minimizes the instance.

#### Returns

`boolean`

### isAccessible()

```typescript
isAccessible(): boolean
```

Returns true if the instance has an accessibility tree.

#### Returns

`boolean`

### isFocused()

```typescript
isFocused(): boolean
```

Returns true if the instance has the focus.

#### Returns

`boolean`

### scoredSearch()

```typescript
scoredSearch(order: TraversalOrder, maxNodes: number, collapseStructural: boolean, query: string, threshold: number): AccessibilityNode[]
```

Search this application's accessibility tree by *concept text*, using
bag-of-words paired-Jaccard scoring against each node's
`overallDescription`
(`simulang_rs::AXNodeSynthetic::summary_with_context`).

Mirrors `simulang_rs::Instance::scored_search` with `BowJaccard` as the
scorer and a permissive filter; returns every node whose score equals
the maximum found and exceeds `threshold`.

* `order`               – `TraversalOrder.DepthFirst` or
  `TraversalOrder.BreadthFirst`
* `max_nodes`           – upper bound on nodes visited (uses `.take()`
  over the walk)
* `collapse_structural` – hoist empty structural wrappers out of the
  walk before scoring
* `query`               – natural-language concept Jaccard-compared
  against each node's `overallDescription`
* `threshold`           – minimum score to keep a node

Returned nodes are full `AccessibilityNode` handles — call action
methods (`activate`, `setValue`, …) directly on them, walk children
with `.children()`, or render a snapshot with `.snapshot()`.

#### Parameters

<ResponseField name={"order"} type={"TraversalOrder"} required />

<ResponseField name={"maxNodes"} type={"number"} required />

<ResponseField name={"collapseStructural"} type={"boolean"} required />

<ResponseField name={"query"} type={"string"} required />

<ResponseField name={"threshold"} type={"number"} required />

#### Returns

`AccessibilityNode[]`

### show()

```typescript
show(): boolean
```

Shows the instance.

#### Returns

`boolean`
