Skip to main content
rb.dialog shows native dialogs. A script reaches for it to tell the user something, ask a yes or no question, or let them pick a file or folder. A call waits while the dialog is open; input, timers and other coroutines keep running. On macOS a dialog call does not return; see rb.dialog on macOS. Needs: a coroutine for every call, so call them inside rb.run or rb.async (see Where code runs); Windows. This script asks for a log file, warns when the user cancels, and confirms the choice:
Outside a coroutine a call raises Dialog.Message() must be called inside Run(), with the call’s name. Message options: title (default "Message" or "Confirm") and level: "info" (default), "warning" (or "warn") or "error", any case. File options: title, location (the starting directory) and, except for open_dir, filters, a list of { name, extensions } with extensions written without the dot. A picker returns nil when the user cancels, so if path then tells the cases apart. That needs min_sdk=3.10.4; on an older release a cancel returns a value that tests true, so check type(path) == "string". The path is absolute, so rb.file and rb.audio.play refuse it; pass it to rb.system.exec or show it to the user.