I'd like to open the native file browsing dialog from the command line, focus the dialog, and then get the full path of the selected file.
The following works nicely, but the dialog is not focused and therefore can't be controlled via the keyboard:
osascript -l JavaScript -e "var app = Application.currentApplication();
app.includeStandardAdditions = true;
app.chooseFile().toString();"
Thanks for any help.,