Skip to main content
rb.ai lets a script ask a model about the screen: where something is (rb.ai.find), what some text says (rb.ai.read), or which of several answers fits (rb.ai.decide). Use it for things you can describe in words but cannot pin down as a pixel color or an image. Before you start:
  • Rebind Pro. rb.ai and rb.phone are part of Rebind Pro. Calls go through the account signed in to Rebind, and the first call from an account without Pro starts its free trial. Each call’s cost counts against the monthly AI allowance, so call on a hotkey or a slow interval, never on every tick.
  • A coroutine. Each call waits for the model, so it must run inside rb.run or a function wrapped in rb.async. Outside one, it raises an error.
  • The ai permission. A script that declares permissions lists ai, or only the calls it uses: ai:find, ai:read, ai:decide. That needs min_sdk=3.9.0 or later. See Permissions.
  • The screen. find and read always send a screenshot, and decide sends one when you pass screen = true or a window. Screen reads work on Windows and macOS; see Platforms.
Every option, return value, and error message is in the SDK reference, under Rebind Pro: rb.ai and rb.phone.

Click something you describe

Press a hotkey and the script finds the button by its description, moves the cursor onto it, and clicks. rb.ai.find returns the centre of what you described in screen coordinates, or nil when it is not on screen.
Without a window option, find looks at the display under the cursor. Pass { window = "Title" } to look inside one window instead. Describe the target the way you would to a person: its label, color, and where it sits.

Read a value off the screen

rb.ai.read returns the text you describe, exactly as it appears. When the text is not on screen it returns an empty string, so check for "" before using the result.
A window names the window by title (on macOS, by title or app name), and the call reads the pixels inside that window’s rectangle. If no window matches, the call raises an error naming the title. find and read combine: find a label, then read the value printed beside it. The at option reads a small box centred on a point.

Wait for something to happen

rb.ai.decide picks one of the choices you give it and returns the model’s confidence from 0 to 1. This script checks the screen once a minute and stops when it is confident a long job has finished, then tells you.
Without screen = true or a window, decide answers from the question alone and sends no screenshot. rb.phone.notify returns { delivered, reason }. There is no phone app yet, so it always returns delivered = false with the reason "no phone connected"; the script falls back to a notification in Rebind.

Keep looks inside one app

A script targeted at an application can promise to read only that application’s window. Add screen:target to its permissions along with a process= or window= target. Then find and read without a window look at the target window instead of the whole display, and Rebind’s install screen shows the narrower grant.
screen:none blocks every look, so a script with it can still use decide without a screenshot but not find or read. Scoped permissions are explained in Permissions.