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.,
Best Answer
I have some Karabiner-EventViewer experience and found out that your "currentApplication()" is not Terminal, as one would think, but actually osascript.
Therefore …
… will at least give you keyboard control.