({{, (RefLink[FrontEndExecute, paclet:ref/FrontEndExecute])[expr]
sends expr to be executed by the Wolfram System front end. }})

OpenersNotesSection(Spacer1)Details

(RefLink[FrontEndExecute, paclet:ref/FrontEndExecute])[expr] sends expr to (RefLink[$FrontEnd, paclet:ref/$FrontEnd]) via WSTP using (RefLink[LinkWrite, paclet:ref/LinkWrite]).

The standard Wolfram System front end can handle only specific notebook manipulation commands such as (RefLink[NotebookApply, paclet:ref/NotebookApply]), (RefLink[NotebookLocate, paclet:ref/NotebookLocate]), and (RefLink[SelectedNotebook, paclet:ref/SelectedNotebook]). It uses the versions of these commands in the FrontEnd` context.

(RefLink[FrontEndExecute, paclet:ref/FrontEndExecute])[(RefLink[FrontEndToken, paclet:ref/FrontEndToken])["name"]] executes named commands in the front end, typically corresponding to menu items.

OpenersPrimaryExamplesSection(Spacer1)Examples  (4)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

This calls the front end's (RefLink[CellPrint, paclet:ref/CellPrint]) function:

FrontEndExecute[FrontEnd`CellPrint[Cell["A","Text"]]]

A

Create a notebook with two cells:

nb=CreateDocument[{"line1","line2"}];

SelectionMove[nb,All,Notebook]

Merge the cells by using a (RefLink[FrontEndToken, paclet:ref/FrontEndToken]):

FrontEndExecute[FrontEndToken[nb,"CellMerge"]]

OpenersExampleSection1(Spacer1)Properties & Relations  (2)

Use (RefLink[FrontEndExecute, paclet:ref/FrontEndExecute]) to do a sequence of front end functions:

nb=FrontEndExecute[FrontEnd`NotebookCreateReturnObject[]];

FrontEndExecute[FrontEnd`NotebookWrite[nb,"text"]]

FrontEndExecute[FrontEnd`SelectionMove[nb,All,Cell]]

FrontEndExecute[FrontEnd`NotebookDelete[nb]]

Carry out the same steps by kernel functions:

nb=NotebookCreate[];

NotebookWrite[nb,"text"]

SelectionMove[nb,All,Cell]

NotebookDelete[nb]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FrontEndTokenExecute, paclet:ref/FrontEndTokenExecute])  ▪  (RefLink[Button, paclet:ref/Button])  ▪  (RefLink[Evaluator, paclet:ref/Evaluator])  ▪  (RefLink[SystemDialogInput, paclet:ref/SystemDialogInput])  ▪  (RefLink[UsingFrontEnd, paclet:ref/UsingFrontEnd])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Executing Notebook Commands Directly in the Front End, paclet:tutorial/ExecutingNotebookCommandsDirectlyInTheFrontEnd])}, {▪(RefLinkPlain[Front End Tokens, paclet:tutorial/FrontEndTokens])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[Low-Level Interface Control, paclet:guide/LowLevelInterfaceControl])}, {▪(RefLinkPlain[Programmatic Notebook & Interface Customization, paclet:guide/ProgrammaticNotebookAndInterfaceCustomization])}, {▪(RefLinkPlain[Custom Interface Construction, paclet:guide/CustomInterfaceConstruction])}, {▪(RefLinkPlain[Low-Level Notebook Programming, paclet:guide/LowLevelNotebookProgramming])}, {▪(RefLinkPlain[Notebook & Interface Customization, paclet:guide/NotebookAndInterfaceCustomization])}})}})