Streamline JXA.

This commit is contained in:
Nuno Cruces 2021-03-03 16:05:11 +00:00
parent 79197f2d9e
commit efd706d1d3
3 changed files with 4 additions and 4 deletions

View file

@ -21,14 +21,14 @@ var res=app.chooseColor({defaultColor:{{json .}}})
var app=Application.currentApplication()
app.includeStandardAdditions=true
app.activate()
var res=app[{{json .Operation}}]({{json .Options}})
var res=app.{{.Operation}}({{json .Options}})
if(Array.isArray(res)){res.join({{json .Separator}})}else{res.toString()}
{{- end}}
{{define "msg" -}}
var app=Application.currentApplication()
app.includeStandardAdditions=true
app.activate()
var res=app[{{json .Operation}}]({{json .Text}},{{json .Options}})
var res=app.{{.Operation}}({{json .Text}},{{json .Options}})
if(res.gaveUp){ObjC.import("stdlib")
$.exit(5)}
if(res.buttonReturned==={{json .Extra}}){res.buttonReturned}else{void 0}

View file

@ -2,7 +2,7 @@ var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var res = app[{{json .Operation}}]({{json .Options}})
var res = app.{{.Operation}}({{json .Options}})
if (Array.isArray(res)) {
res.join({{json .Separator}})
} else {

View file

@ -2,7 +2,7 @@ var app = Application.currentApplication()
app.includeStandardAdditions = true
app.activate()
var res = app[{{json .Operation}}]({{json .Text}}, {{json .Options}})
var res = app.{{.Operation}}({{json .Text}}, {{json .Options}})
if (res.gaveUp) {
ObjC.import("stdlib")
$.exit(5)