# UIHelper.forApp

Create a query client pinned to one app.

```js
UIHelper.forApp(bundleId)
```

## Arguments

| Argument | Type | Meaning |
| --- | --- | --- |
| `bundleId` | string | Nonempty app bundle ID. |

## Returns

UIHelper client.

## Example

```js
if (!openApp("com.apple.Preferences")) throw new Error("Open failed");
const ui = UIHelper.forApp("com.apple.Preferences");
console.log(ui.getTree());
```

## Notes

Without forApp(), UIHelper queries the foreground app.

[All JavaScript APIs](https://mcp.applesauceos.com/doc/api.md) · [Automation playbook](https://mcp.applesauceos.com/doc/ai.md)
