As a very simple example, let’s display the number of Mail
accounts for the current user. Note the template string in
the call to displayDialog
in
line 5: This form will be
used quite often because it allows very compact, albeit
sometimes a bit strange looking strings. Also, it is very
easy to embed variable values or expressions in the string
itself.
(() => {
const app = Application("Mail");
app.includeStandardAdditions = true;
const accountNo = app.accounts().length;
app.displayDialog(`You have ${accountNo} mail accounts`,
{withTitle: "Mail info"});
})()