19 lines
No EOL
419 B
Text
19 lines
No EOL
419 B
Text
var app = Application.currentApplication()
|
|
app.includeStandardAdditions = true
|
|
app.activate()
|
|
|
|
ObjC.import("stdlib")
|
|
ObjC.import("stdio")
|
|
var opt = {{json .Options}}
|
|
{{- if .IconPath}}
|
|
opt["withIcon"] = Path("{{.IconPath}}")
|
|
{{- end}}
|
|
var res = app.{{.Operation}}({{json .Text}}, opt)
|
|
if (res.gaveUp) {
|
|
$.exit(5)
|
|
}
|
|
if (res.buttonReturned === {{json .Extra}}) {
|
|
$.puts(res.buttonReturned)
|
|
$.exit(1)
|
|
}
|
|
res.textReturned |