zenity/osa_scripts/file.gots
2020-01-05 03:21:39 +00:00

28 lines
No EOL
507 B
Text

var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var opts = {}
opts.withPrompt = {{.Prompt}}
opts.multipleSelectionsAllowed = {{.Multiple}}
{{if .Location -}}
opts.defaultLocation = {{.Location}}
{{end -}}
{{if .Type -}}
opts.ofType = {{.Type}}
{{end -}}
var res
try {
res = app[{{.Operation}}](opts)
} catch (e) {
if (e.errorNumber !== -128) throw e
}
if (Array.isArray(res)) {
res.join('\0')
} else if (res != null) {
res.toString()
} else {
void 0
}