Front end tokens let you perform kernel commands that would normally be done using the menus. Front end tokens are particularly convenient for writing programs to manipulate notebooks.
FrontEndToken is a kernel command that identifies its argument as a front end token. FrontEndExecute is a kernel command that sends its argument to the front end for execution. For example, the following command creates a new notebook.
FrontEndExecute can take a list as its argument, allowing you to execute multiple tokens in a single evaluation. When you evaluate the following command, the front end creates a new notebook and then pastes the contents of the clipboard into that notebook.
Simple and Compound Front End Tokens
Front end tokens are divided into two classes: simple tokens and compound tokens that take parameters.
For example, the following command will save the input notebook.
Compound tokens have a token parameter that controls some aspect of their behavior. For a compound token, the three arguments of FrontEndToken must be a NotebookObject, the front end token, and the selected token parameter.
For example, this saves the selected notebook as plain text.