2020-01-21 07:03:58 -05:00
|
|
|
var app = Application.currentApplication()
|
|
|
|
app.includeStandardAdditions = true
|
|
|
|
app.activate()
|
|
|
|
|
2021-10-06 18:39:36 -04:00
|
|
|
ObjC.import("stdlib")
|
|
|
|
ObjC.import("stdio")
|
|
|
|
var opt = {{json .Options}}
|
|
|
|
{{- if .IconPath}}
|
|
|
|
opt["withIcon"] = Path("{{.IconPath}}")
|
|
|
|
{{- end}}
|
|
|
|
var res = app.{{.Operation}}({{json .Text}}, opt)
|
2020-01-28 07:46:43 -05:00
|
|
|
if (res.gaveUp) {
|
|
|
|
$.exit(5)
|
|
|
|
}
|
|
|
|
if (res.buttonReturned === {{json .Extra}}) {
|
2021-03-03 21:52:05 -05:00
|
|
|
$.puts(res.buttonReturned)
|
|
|
|
$.exit(1)
|
2021-03-04 21:01:59 -05:00
|
|
|
}
|
|
|
|
res.textReturned
|