31 lines
No EOL
598 B
Text
31 lines
No EOL
598 B
Text
var app = Application.currentApplication()
|
|
app.includeStandardAdditions = true
|
|
app.activate()
|
|
|
|
var opts = {}
|
|
|
|
{{if .Prompt -}}
|
|
opts.withPrompt = {{.Prompt}}
|
|
{{end -}}
|
|
{{if .Type -}}
|
|
opts.ofType = {{.Type}}
|
|
{{end -}}
|
|
{{if .Name -}}
|
|
opts.defaultName = {{.Name}}
|
|
{{end -}}
|
|
{{if .Location -}}
|
|
opts.defaultLocation = {{.Location}}
|
|
{{end -}}
|
|
{{if .Invisibles -}}
|
|
opts.invisibles = {{.Invisibles}}
|
|
{{end -}}
|
|
{{if .Multiple -}}
|
|
opts.multipleSelectionsAllowed = {{.Multiple}}
|
|
{{end -}}
|
|
|
|
var res = app[{{.Operation}}](opts)
|
|
if (Array.isArray(res)) {
|
|
res.join({{.Separator}})
|
|
} else {
|
|
res.toString()
|
|
} |