var app = Application.currentApplication() app.includeStandardAdditions = true app.activate() var opts = {} {{if .Message -}} opts.message = {{.Message}} {{end -}} {{if .As -}} opts.as = {{.As}} {{end -}} {{if .Title -}} opts.withTitle = {{.Title}} {{end -}} {{if .Icon -}} opts.withIcon = {{.Icon}} {{end -}} {{if .Buttons -}} opts.buttons = {{.Buttons}} {{end -}} {{if .Default -}} opts.defaultButton = {{.Default}} {{end -}} {{if .Cancel -}} opts.cancelButton = {{.Cancel}} {{end -}} var res = app[{{.Operation}}]({{.Text}}, opts).buttonReturned res === {{.Extra}} ? res : void 0