dialog
stableNative OS file and message dialogs for desktop applications, providing file pickers, folder selectors, save dialogs, and confirmation prompts.
use plugin dialog Plugin snippets can be edited in the Playground, but native capabilities are executed locally with the Zolo CLI.
Functions (9)
- open_file Opens a single-file picker dialog
- open_files Opens a multi-file picker dialog
- open_folder Opens a single-folder picker dialog
- open_folders Opens a multi-folder picker dialog
- save_file Opens a save-file dialog
- message Shows an informational message dialog
- confirm Shows a Yes/No confirmation dialog
- ok_cancel Shows an OK/Cancel dialog
- yes_no_cancel Shows a Yes/No/Cancel dialog
From import to result
- 01Import only what you use
- 02Copy the smallest example
- 03Run it with the Zolo CLI
Opens a single-file picker dialog
Opens a native file picker dialog and returns the selected file path as a string, or nil if the user cancels. The optional config table supports title, directory (initial directory), file_name (default name), and filters (array of {name, extensions} objects).
use plugin dialog::{open_file}
let path = open_file(#{"title": "Open Image", "filters": [#{"name": "Images", "extensions": ["png", "jpg"]}]})
if path != nil {
print("Selected: {path}")
}Opens a multi-file picker dialog
Opens a file picker that allows selecting multiple files. Returns a table (array) of file path strings, or nil if cancelled.
use plugin dialog::{open_files}
let paths = open_files(#{"title": "Select files"})
if paths != nil {
let i = 1
while i <= table_len(paths) {
print(paths[i])
i = i + 1
}
}Opens a single-folder picker dialog
Opens a folder picker dialog and returns the selected folder path, or nil if cancelled.
use plugin dialog::{open_folder}
let folder = open_folder(#{"title": "Choose output directory"})
if folder != nil {
print("Output: {folder}")
}Opens a multi-folder picker dialog
Opens a folder picker that allows selecting multiple folders. Returns a table (array) of folder path strings, or nil if cancelled.
use plugin dialog::{open_folders}
let dirs = open_folders()
if dirs != nil {
print("Selected {table_len(dirs)} folders")
}Opens a save-file dialog
Opens a save-file dialog and returns the chosen save path (which may not yet exist), or nil if cancelled. Supports the same config options as open_file.
use plugin dialog::{save_file}
let dest = save_file(#{"title": "Save Report", "file_name": "report.csv"})
if dest != nil {
print("Saving to: {dest}")
}Shows an informational message dialog
Shows a modal message dialog with the given title and body text. level can be "info" (default), "warning", or "error".
use plugin dialog::{message}
message("Success", "File exported successfully.")
message("Warning", "Disk space is low.", "warning")
message("Error", "Could not connect to server.", "error")Shows a Yes/No confirmation dialog
Shows a Yes/No dialog and returns true if the user clicked Yes, false otherwise. Use for irreversible actions.
use plugin dialog::{confirm}
let ok = confirm("Delete file?", "This action cannot be undone.")
if ok {
print("Deleting...")
}Shows an OK/Cancel dialog
Shows an OK/Cancel dialog and returns true if OK was clicked.
use plugin dialog::{ok_cancel}
let proceed = ok_cancel("Apply changes?", "Settings will be updated.")
if proceed {
print("Changes applied.")
}Shows a Yes/No/Cancel dialog
Shows a Yes/No/Cancel dialog and returns "yes", "no", or "cancel" depending on which button was clicked.
use plugin dialog::{yes_no_cancel}
let choice = yes_no_cancel("Save changes?", "Do you want to save before closing?")
if choice == "yes" {
print("Saving...")
} else if choice == "no" {
print("Discarding changes.")
} else {
print("Cancelled.")
}