zenity/internal/zenutil/osascripts/file.gots

31 lines
598 B
Text
Raw Normal View History

2020-01-04 22:21:39 -05:00
var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var opts = {}
2020-01-14 20:04:06 -05:00
{{if .Prompt -}}
opts.withPrompt = {{.Prompt}}
{{end -}}
2020-01-04 22:21:39 -05:00
{{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-14 20:04:06 -05:00
{{if .Invisibles -}}
opts.invisibles = {{.Invisibles}}
{{end -}}
{{if .Multiple -}}
opts.multipleSelectionsAllowed = {{.Multiple}}
{{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-08 21:38:10 -05:00
res.join({{.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
}