Streamline JXA.
This commit is contained in:
parent
79197f2d9e
commit
efd706d1d3
3 changed files with 4 additions and 4 deletions
|
@ -21,14 +21,14 @@ var res=app.chooseColor({defaultColor:{{json .}}})
|
||||||
var app=Application.currentApplication()
|
var app=Application.currentApplication()
|
||||||
app.includeStandardAdditions=true
|
app.includeStandardAdditions=true
|
||||||
app.activate()
|
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()}
|
if(Array.isArray(res)){res.join({{json .Separator}})}else{res.toString()}
|
||||||
{{- end}}
|
{{- end}}
|
||||||
{{define "msg" -}}
|
{{define "msg" -}}
|
||||||
var app=Application.currentApplication()
|
var app=Application.currentApplication()
|
||||||
app.includeStandardAdditions=true
|
app.includeStandardAdditions=true
|
||||||
app.activate()
|
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")
|
if(res.gaveUp){ObjC.import("stdlib")
|
||||||
$.exit(5)}
|
$.exit(5)}
|
||||||
if(res.buttonReturned==={{json .Extra}}){res.buttonReturned}else{void 0}
|
if(res.buttonReturned==={{json .Extra}}){res.buttonReturned}else{void 0}
|
||||||
|
|
|
@ -2,7 +2,7 @@ var app = Application.currentApplication()
|
||||||
app.includeStandardAdditions = true
|
app.includeStandardAdditions = true
|
||||||
app.activate()
|
app.activate()
|
||||||
|
|
||||||
var res = app[{{json .Operation}}]({{json .Options}})
|
var res = app.{{.Operation}}({{json .Options}})
|
||||||
if (Array.isArray(res)) {
|
if (Array.isArray(res)) {
|
||||||
res.join({{json .Separator}})
|
res.join({{json .Separator}})
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2,7 +2,7 @@ var app = Application.currentApplication()
|
||||||
app.includeStandardAdditions = true
|
app.includeStandardAdditions = true
|
||||||
app.activate()
|
app.activate()
|
||||||
|
|
||||||
var res = app[{{json .Operation}}]({{json .Text}}, {{json .Options}})
|
var res = app.{{.Operation}}({{json .Text}}, {{json .Options}})
|
||||||
if (res.gaveUp) {
|
if (res.gaveUp) {
|
||||||
ObjC.import("stdlib")
|
ObjC.import("stdlib")
|
||||||
$.exit(5)
|
$.exit(5)
|
||||||
|
|
Loading…
Reference in a new issue