Tip: GUI-fying scripts with alert and filepanel

This tip first appeared on betips.net and has been updated.

BeOS has long had the alert command. With alert, you can put up a little message on the screen with one to three buttons:

alert “Hello World” “go away” “hello” “ok”

With Haiku, the dev team seems to have slipped something else in quietly: filepanel. I remember that this was originally a download on Bebits, just around the end of the BeOS era, but it is now firmly part of the OS.

filepanel -d ~/Desktop -t “Open a File”

filepanel returns the full pathname of the selected file to standard output. This means that scripts can ask the user where an app should be installed, for example, or whether to put a symlink in the Deskbar menu and what to call it.

Documentation seems limited to running filepanel with the –help parameter.

Want more ways to integrate the command line and the GUI like this?

Install hdialog  from this repo.