rb.ai asks a model about the screen: decide picks one of the script’s
choices, find locates what a description names, and read returns the text
it names. It is part of Rebind Pro: the first call from a
signed-in account without Pro starts its free 7-day trial, and each call’s cost
counts against the month’s AI allowance, then the account’s credits. A
marketplace listing that uses it is
marked Pro.
Needs: the ai permission, or
ai:decide, ai:find or ai:read for one call, in a script that declares
permissions (a script with no permission= line may call all three), plus
screen or screen:target for
every call that looks at the screen; a coroutine for every call, so call
decide, find and read inside rb.run or rb.async (see
Where code runs); min_sdk=3.10.0.
This script moves the pointer to the Store button when F7 is pressed, then asks
whether a dialog is open:
What a call looks at:
window: a window title (on macOS, a title or app name). The call reads the screen inside that window’s rectangle, including anything drawn over it. No match, or a minimized or off-screen window, raises.- Without
window,findandreadlook at the display under the cursor, or at the target window when the script declaresscreen:target.decidelooks only withscreen = true, awindowor aregion; otherwise it answers from the question andstate. at(forread, and fordecidetogether withscreen = trueor awindow): a point, such as onefindreturned. The call reads a 400 by 160 box centered on it.region(fordecide;min_sdk3.22.0): a rectangle{ x, y, w, h }in screen coordinates. The call reads only that rectangle, so small detail such as a health bar stays legible. A rectangle is shrunk only when it is over 1,024 pixels of the display on its long edge (512 points on a 2x display). Passatorregion, not both.
decide takes 2 to 32 distinct choices of 1 to 200 characters and a question
of up to 4,000; find and read take a description of up to 1,000 characters.
No call is retried. A call ends by itself after about 10 seconds with the
timeout error in the list below.
Errors:
rb.ai needs Rebind Pro: AI is part of Rebind Pro. Sign in to start your free 7-day trial.when signed out, orrb.ai needs Rebind Pro: AI is part of Rebind Pro, and this account's trial has been used.rb.ai: This month's AI allowance is used up. Add credits to keep going; it resets on the 1st.rb.ai: the model took too long; try againrb.ai.find: needs the 'ai' permission: add -- rebind: permission=airb.ai.find waits for an answer: call it inside rb.run(with the call’s name), for a call made outside a coroutine.
Facts and choices
Needs:min_sdk=3.22.0.
decide takes what the script already knows apart from the question:
state: the facts, as a string or a table, which is sent as JSON. An empty string or table raises. Keep the question for the rule and put the facts here. Withstateand no look, the call sends no screenshot and needs noscreenpermission. A value JSON cannot hold raises with its key, such asrb.ai.decide: opts.state.target.on_hit cannot be sent: it is a function.descriptions: a table from a choice to what it means, up to 300 characters each. Every key must be one ofchoices.
state and
descriptions when given, and the screenshot when the call looks. Nothing else
from the script is sent.
The whole answer
Needs:min_sdk=3.22.0.
decide returns a third value, a table:
To act only on a sure answer, compare
detail.probabilities[choice] with a
threshold you have checked against your own cases. confidence is not the
picked choice’s probability.
This script asks which kind of text is on the clipboard, passing it as
state, and logs the choice with its probability and the call’s cost: