Working with @commands
@Commands are special @functions that perform immediate actions in the user interface. Most @commands mimic menu commands. For example, the following formula, if executed from a button, puts the current document in Edit mode and moves the insertion point down twice:
@Command([EditDocument]; "1");
@Command([EditDown]; "2")
The syntax for an @command is one of the following:
@Command([command-name]; arg1; arg2; ... argn)
@PostedCommand([command-name]; arg1; arg2; ... argn)
The name of the @function is @Command or @PostedCommand. The first argument is the name of the @command enclosed in brackets. The remaining arguments are the arguments to the @command.
You can use @commands in formulas for toolbar buttons, agents that do not specify target documents, events, button hotspots, and action hotspots. You cannot use @commands in a formula that does not interact with the user. These include replication, form, selection, column, hide action, window title, section title, section access, insert subform, hidden paragraph, default value, input translation, input validation, computed value, and keyword field formulas, and agents other than those that specify no target documents.
You cannot use most @commands in Web applications, since @commands are based on the Notes® workstation user interface. About 30 @commands are supported but some behave differently. See "Programming Domino® for Web Applications," "Formula language."
You cannot use @commands with LotusScript®.
@Command functions execute in sequence with other @functions, with some exceptions. For example, the following formula executes the @command first:
@Command([EditDocument]; "1");
@Prompt([Ok]; "Edit mode"; "The document is now in Edit mode.")
@PostedCommand functions execute in sequence with each other after all other @functions execute. This emulates the behavior of @Command in Notes® R3. For example, the following formula executes the @command last:
@PostedCommand([EditDocument]; "1");
@Prompt([Ok]; "Edit mode"; "The document will go into Edit mode.")
You can check and respond to the return value of @Command (but not @PostedCommand). The return value is @True if the @command succeeds and @False if it fails. The following toolbar button formula returns if the FileOpenDatabase @command fails.
@If(@Command([FileOpenDatabase]; "NEWSUBJ"); ""; @Return(""));
@Command([Compose]; ""; "Main Topic");
@Command([EditGotoField]; "Subject");
@Command([EditInsertText]; "New subject");
@Command([EditGotoField]; "Body")