var app = Application.currentApplication() app.includeStandardAdditions = true app.activate() var res = app[{{json .Operation}}]({{json .Text}}, {{json .Options}}) if (res.gaveUp) { ObjC.import("stdlib") $.exit(5) } if (res.buttonReturned === {{json .Extra}}) { res } else { void 0 }