2020-01-04 22:21:39 -05:00
|
|
|
var app = Application.currentApplication()
|
|
|
|
app.includeStandardAdditions = true
|
|
|
|
app.activate()
|
|
|
|
|
|
|
|
var opts = {}
|
|
|
|
opts.withPrompt = {{.Prompt}}
|
|
|
|
opts.multipleSelectionsAllowed = {{.Multiple}}
|
|
|
|
|
|
|
|
{{if .Type -}}
|
|
|
|
opts.ofType = {{.Type}}
|
|
|
|
{{end -}}
|
2020-01-06 07:01:51 -05:00
|
|
|
{{if .Name -}}
|
|
|
|
opts.defaultName = {{.Name}}
|
|
|
|
{{end -}}
|
|
|
|
{{if .Location -}}
|
|
|
|
opts.defaultLocation = {{.Location}}
|
|
|
|
{{end -}}
|
2020-01-04 22:21:39 -05:00
|
|
|
|
2020-01-06 07:01:51 -05:00
|
|
|
var res = app[{{.Operation}}](opts)
|
2020-01-04 22:21:39 -05:00
|
|
|
if (Array.isArray(res)) {
|
2020-01-06 07:01:51 -05:00
|
|
|
res.join(String.fromCodePoint({{.Separator}}))
|
2020-01-04 22:21:39 -05:00
|
|
|
} else {
|
2020-01-06 07:01:51 -05:00
|
|
|
res.toString()
|
2020-01-04 22:21:39 -05:00
|
|
|
}
|