# What is the complete list of valid FrontEnd Packet types?

In response to my question How can I get the unchanged Box form of an arbitrary expression? John Fultz answered with a method using the hilariously named FrontEndUndocumentedTestFEParserPacket.

What is the complete list of such Packets?

Related:

• @John I didn't know you were here. Would you like to answer instead, and I'll delete mine? – Mr.Wizard Oct 22 '12 at 16:03
• Your answer is fine. And...the list that command returns is exhaustive. – John Fultz Oct 23 '12 at 2:25

Once again thanks to John Fultz we know a command that returns the complete list of these packets:

MathLinkCallFrontEnd[FrontEndNeedCurrentFrontEndSymbolsPacket[]][[1, 1, 4]]


Results from Mathematica 7:

""
"Null"
"CompoundExpression"
"List"
"Execute"
"FrontEndExecute"
"KernelExecute"
"KernelStartupCompleted"
"ReassignInputNamePacket"
"InputNamePacket"
"OutputNamePacket"
"ReturnTextPacket"
"ReturnInputFormPacket"
"ReturnPacket"
"TextPacket"
"DisplayPacket"
"DisplayEndPacket"
"SyntaxPacket"
"InputPacket"
"InputStringPacket"
"ExperimentalInputMouseCoordinatesPacket"
"MessagePacket"
"ConsoleMessagePacket"
"PrintTemporaryPacket"
"SuspendPacket"
"ResumePacket"
"BeginDialogPacket"
"EndDialogPacket"
"EvaluatorStart"
"EvaluatorQuit"
"EvaluatorInterrupt"
"EvaluatorAbort"
"EvaluatorHalt"
"EnterSubsession"
"ExitSubsession"
"Forward"
"ForwardEvaluate"
"ForwardedData"
"CompletionsListPacket"
"SpellingSuggestionsPacket"
"NotebookResetGeneratedCells"
"DontNotebookResetGeneratedCells"
"BeginFrontEndInteractionPacket"
"EndFrontEndInteractionPacket"
"DisplaySetSizePacket"
"DisplayFlushImagePacket"
"FlushPrintOutputPacket"
"FrontEndToken"
"Version"
"VersionNumber"
"DefaultFormatTypeForStyle"
"Notebooks"
"SelectedNotebook"
"SetSelectedNotebook"
"InputNotebook"
"EvaluationNotebook"
"SetEvaluationNotebook"
"ButtonNotebook"
"ClipboardNotebook"
"MessagesNotebook"
"HelpBrowserNotebook"
"DefaultHelpViewerNotebook"
"DebuggerContinue"
"DebuggerContinueToSelection"
"DebuggerSelect"
"DebuggerSetStackList"
"DebuggerSetExpressionColoring"
"DebuggerGetSelectionInformation"
"DebuggerRemoveBreakpoint"
"DebuggerEnableBreakpoint"
"DebuggerDisableBreakpoint"
"DebuggerSetAutoContinueBreakpoint"
"DebuggerSetNoAutoContinueBreakpoint"
"DebuggerSetBreakOnAssignmentWatchpoint"
"DebuggerSetNoBreakOnAssignmentWatchpoint"
"DebuggerSetBreakOnEvaluationWatchpoint"
"DebuggerSetNoBreakOnEvaluationWatchpoint"
"DebuggerSetBreakOnFunctionWatchpoint"
"DebuggerSetNoBreakOnFunctionWatchpoint"
"DebuggerToolsNotebook"
"DebuggerStackNotebook"
"DebuggerBreakpointsNotebook"
"EvaluationCell"
"ButtonCell"
"NotebookCreate"
"NotebookCreateReturnObject"
"NotebookOpen"
"NotebookOpenReturnObject"
"NotebookLocate"
"NotebookLocateReturnResult"
"SystemOpen"
"HelpBrowserLookup"
"HelpBrowserLookupReturnResult"
"HelpBrowserGetListBoxList"
"HelpBrowserSetListBoxItem"
"NotebookClose"
"NotebookSave"
"NotebookSaveAs"
"NotebookConvert"
"NotebookPrint"
"NotebookImage"
"ToExpression"
"NotebookPut"
"NotebookPutReturnObject"
"NotebookGet"
"NotebookWrite"
"NotebookApply"
"CellPrint"
"NotebookDelete"
"NotebookFind"
"NotebookFindReturnObject"
"SelectionMove"
"SelectionCreateCell"
"SelectionCellCreateCell"
"SelectionDuplicateCell"
"SelectionEvaluate"
"SelectionEvaluateCreateCell"
"SelectionEvaluateApply"
"FileBrowse"
"DirectoryBrowse"
"ChooseColor"
"RecordSound"
"Options"
"FullOptions"
"AbsoluteOptions"
"LocalOptions"
"LocalAbsoluteOptions"
"SetOptions"
"RemoveOptions"
"SetLocalOptions"
"SaveConversionOptions"
"RestoreConversionOptions"
"SelectionSetStyle"
"CallPacket"
"Value"
"SetValue"
"Select2DTool"
"Select3DTool"
"Argument"
"SetArgument"
"ChildObject"
"ObjectChildren"
"ObjectChildCount"
"NextSiblingObject"
"PreviousSiblingObject"
"ParentObject"
"SelectObject"
"SelectedObject"
"OutputCellObject"
"ObjectGet"
"ObjectPut"
"SelectNamedObject"
"ReplaceNamedObject"
"SelectionApply"
"SelectionCellsMap"
"SelectionCellContentsMap"
"EvaluatePacket"
"SetKernelSymbolContexts"
"UpdateKernelSymbolContexts"
"SetFunctionInformation"
"UpdateDynamicObjects"
"UpdateDynamicObjectsSynchronous"
"ControllerBindingsInOutput"
"ReturnDynamicOutput"
"NotebookInformation"
"CellInformation"
"ToFileName"
"SetPersistentFrontEnd"
"OpenFunctionInspectorPacket"
"GetErrorsInSelectionPacket"
"ErrorIconIsDisplayedPacket"
"UndocumentedTestFEParserPacket"
"UndocumentedGetSelectionPacket"
"UndocumentedBoxInformationPacket"
"UndocumentedBoxStatisticsPacket"
"UndocumentedHangFrontEndPacket"
"UndocumentedCrashFrontEndPacket"
"UndocumentedGetNGraphicsImagePacket"
"UndocumentedGetBoxTypesPacket"
"UndocumentedWhyTheBeepText"
"ReparseBoxStructurePacket"
"SetBoxIDs"
"GetBoxIDs"
"RemoveBoxIDs"
"BoxReferenceExists"
"BoxReferenceFind"
"BoxReferenceReplace"
"BoxReferenceSetOptions"
"BoxReferenceGetOptions"
"UndocumentedProtoTypeBuild"
"ImportToNotebook"
"ConvertToPostScriptPacket"
"ConvertToPostScriptPacket2"
"VerboseConvertToPostScriptPacket"
"ConvertToBitmapPacket"
"VerboseConvertToBitmapPacket"
"ExportPacket"
"GetLinebreakInformationPacket"
"GetPageBreakInformationPacket"
"GetSelectionBoundingBoxes"
"GetBoundingBoxSizePacket"
"NotebookSetupLayoutInformationPacket"
"NotebookGetLayoutInformationPacket"
"NotebookGetFontParametersPacket"
"NotebookGetMisspellingsPacket"
"InputToBoxFormPacket"
"ExpressionPacket"
"ReturnExpressionPacket"
"CreatePalettePacket"
"SetNotebookStatusLine"
"SetBoxFormNamesPacket"
"NeedCurrentFrontEndPackagePacket"
"NeedCurrentFrontEndSymbolsPacket"
"SpeakTextPacket"
"SetSpeechParametersPacket"
"CurrentlySpeakingPacket"
"BeepPacket"
"PlaySoundPacket"
"PlaySoundFilePacket"
"TimeConstrained"
"MemoryConstrained"
"GetFrontEndOptionsDataPacket"
"TemplateTooltipPacket"
"GetCellTagsPacket"
"NotebookReleaseHold"
"NotebookDynamicToLiteral"
"NotebookCreateDynamicCaches"
"SelectionRemoveCellTags"
"SelectionAnimate"
"RegisterConverter"
"DebugTooltipPacket"
"CursorTooltipPacket"
"Install"
"SetJavaParameter"
"FindFileOnPath"
"GetFunctionCategories"
"CopyToClipboard"
"SimulateMouseMove"
"SimulateMouseClick"
"SimulateMouseDrag"
"SimulateKeyPress"
"SimulatedEventPending"
"AttachWindow"
"DetachWindow"
"AttachedWindowRequestingModality"
"AttachedWindowReleasingModality"
"MLFSPut"
"MLFSPutAppend"
"MLFSGet"
"MLFSOpenRead"
"MLFSOpenWrite"
"MLFSOpenAppend"
"MLFSClose"
"MLFSStreamPosition"
"MLFSSetStreamPosition"
"MLFSRead"
"MLFSWriteString"
"MLFSURLDownload"
"MLFSFileNames"
"MLFSCopyFile"
"MLFSRenameFile"
"MLFSDeleteFile"
"MLFSFileByteCount"
"MLFSFileDate"
"MLFSSetFileDate"
"MLFSFileType"
"MLFSCreateDirectory"
"MLFSDeleteDirectory"
"MLFSRenameDirectory"
"MLFSCopyDirectory"
"UpdateNewPrimitiveStyle"
"PluginNewNotebook"
"PluginOpenNotebook"
"PluginCloseNotebook"
"PluginQuit"
"PluginAssignParent"
"PluginSizeNotebook"
"PluginRedrawNotebook"
"PluginGetContextMenuForNotebook"


Missing from 10.0.2 that were present in 7:

"ButtonCell"
"PluginRedrawNotebook"


Present in 10.0.2 and not in 7:

"ActivateLicense"
"ApplyStyle"
"AttachCell"
"AttachedCellParent"
"BibChooseCitationStylePacket"
"BibDeleteBibliographyPacket"
"BibDeleteCitationsPacket"
"BibInsertBibliographyPacket"
"BibInsertCitationPacket"
"BibInsertNotePacket"
"BibInsertSpecificCitationPacket"
"BibQueryCitationsPacket"
"BibQueryCitationStylesPacket"
"BibQueryNoteStylesPacket"
"BibRebuildBibliographyPacket"
"BibRebuildCitationsPacket"
"BibRefreshCitationsPacket"
"BibRefreshCitationStylesPacket"
"BibSetBibNoteStylePacket"
"BibSetCitationStylePacket"
"Boxes"
"BoxReferenceBoxObject"
"CAQueryAutocompletionPacket"
"CDFDeploy"
"CDFInformation"
"Cells"
"CryptoHash"
"DetachCell"
"ErrorMessage"
"EvaluationBox"
"FinishStartup"
"FlushTextResourceCaches"
"ForwardAndHandle"
"GetMouseAppearance"
"LinguisticTranslateCellPacket"
"NewVersionAction"
"NewVersionAvailable"
"NotebookEvaluate"
"NotebookEvaluateReturn"
"NotebookPredictions"
"OptionCompletionsListPacket"
"OptionValuesCompletionsListPacket"
"ParentBox"
"ParentCell"
"ParentNotebook"
"PastePrediction"
"PluginKeyDown"
"PluginKeyUp"
"PluginMouseDown"
"PluginMouseMove"
"PluginMouseUp"
"PluginNotebookFileError"
"PluginOpenNotebookStream"
"PluginPrint"
"PluginSave"
"PluginSetActiveWindow"
"PluginSetViewRegion"
"PluginUpdateScrollPositionRelative"
"RewriteExpressionPacket"
"SampleStyle"
"SelectionSetInlineCellOptions"
"SelectionSetPointStyle"
"SetMouseAppearance"
"SetNotebookInList"
"StartupAction"
"SuppressGraphicsHighlight"
"TemplateCachePacket"
"TickleActivation"
"WindowsCodePage"
"WolframCloudAssignCloudObject"
"WolframCloudAutomaticCloudLogin"
"WolframCloudConnectionAuthorized"
"WolframCloudConnectionCancelled"
"WolframCloudConnectionEstablished"
"WolframCloudConnectionFailed"
"WolframCloudConnectionInitiated"
"WolframCloudConnectionTerminated"
"WolframCloudUploadComplete"
"WolframCloudUploadInitiated"


Missing from 11.0.1 that were present in 10.0.2:

"AttachedWindowReleasingModality"
"AttachedWindowRequestingModality"
"AttachWindow"
"DetachWindow"
"ExperimentalInputMouseCoordinatesPacket"
"GetFunctionCategories"
"HelpBrowserGetListBoxList"
"HelpBrowserLookup"
"HelpBrowserLookupReturnResult"
"HelpBrowserNotebook"
"HelpBrowserSetListBoxItem"
"SelectionAnimate"


Several of these removed packets were for pre-version-6 features. SelectionAnimate is for animating a cell group and the HelpBrowserLookup packets are for opening the v5-style help browser, which was still available in v10 but removed from v11.

Present in 11.0.1 but not in 10.0.2

"CACADumpTriePacket"
"FromFileNameString"
"NotebookGetMisspellingsInStringPacket"
"NotebookGetSpellingSuggestionsPacket"
"NotebookToString"
"WolframCloudGenerateFileName"
"WolframCloudGetAuthentication"
"WolframCloudLogout"

• Do you have any advice on figuring out how these are used? Many seem to have made their way into top-level symbols (for example there is SystemGetMenusPacket) but it's unclear how they are used. A simple MathLinkCallFrontEnd@GetMenusPacket[] has no effect. – b3m2a1 Dec 12 '16 at 5:25
• @MB1965 Sorry, I don't. I have figured out a few by sheer luck I think, but most of the time I have to see it used somewhere. Try a plain text search of all the files in the Mathematica installation directory; sometimes you get lucky. – Mr.Wizard Dec 12 '16 at 9:32

I thought I'd keep a running tally of what I know about these packets (excluding the obvious ones like CreatePalettePacket) just for reference.

## Text / Box interchange

### ReparseBoxStructurePacket

This one parses a string (as far as I can tell just a string) into a box structure. We can use this to, for example, parse out the string which comes as the last output of NeedCurrentFrontEndSymbolsPacket and convert it directly to a box expression:

Cell[
BoxData@
FrontEndExecute[
FrontEndReparseBoxStructurePacket[
FrontEndExecute@FrontEndNeedCurrentFrontEndSymbolsPacket[] //
Last]],
"Output"
] // CellPrint


### ExportPacket

This one is enormously useful. I first saw it here.

The basic usage is:

ExportPacket[
expr:_Cell|_Notebook,
fmt_,
opts___?OptionQ
]


You can also call it like:

ExportPacket[
expr:_Cell|_Notebook,
fmt_,
file_
opts___?OptionQ
]


in which case it dumps to a file.

## GetBoundingBoxSizePacket

This computes the display size of Cell expressions. It's just called as:

FrontEndGetBoundingBoxSizePacket[c_Cell]


It returns the horizontal size, the vertical content size, and what I believe is the vertical content padding as its third result. I use it here and here

## Syntax-coloring

### UpdateKernelSymbolContexts

Used to set symbol coloring in the FE. See this for more info

This tells the front end that this function used to generate side effects, back when Graphics were side effects.

It's used like:

FrontEndAddUsedToGenerateSideEffectGraphicsFunctions[
{
{context1,
{
function1,
function2,
...
}
},
{context2,
{
function3,
function4,
...
}
},
...
}
]


As an example you can try:

FrontEndExecute@
{
{"Global", {"notARealGraphics"}}
}
]


And now if you type:

notARealGraphics[];


that final semicolon will be colored red

This is used like AddUsedToGenerateSideEffectGraphicsFunctions:

FrontEndAddOptionInformationToFunctions[
{
{context1,
{
{function1, {opName1, ...}},
{function2, {opName2, ...}},
...
}
},
{context2,
{
{function3, {opName3, ...}},
{function4, {opName4, ...}}
...
}
},
...
}
]


Here's an example:

FrontEndExecute@
FrontEndAddOptionInformationToFunctions[
{
{
"Global",
{
{"func", {"a", "b", "c"}}
}
}
}
]


func[notABOrC->] will then have notABOrC colored red. This is clearly how SyntaxInformation "OptionNames" work.

## Autocompletion

### CACADumpTriePacket

Seems to extract data from an autocompletion .trie file:

Used like

FrontEndExecute@


e.g.:

FrontEndExecute@
CACADumpTriePacket@First@
FileNames["*.trie",
PacletFind["AutoCompletionData"][[1]]["Location"], Infinity][[1]]


BEWARE: If the file isn't a properly formatted trie file this will crash your system.

## Resource finding

### FindFileOnPath

Used as:

FrontEndExecute@
FrontEndFindFileOnPath[
fileName,
path
]


Where path is one of:

{
"CharacterEncodingsPath",
"ConfigurationPath",
"ConvertersPath",
"NotebookPath",
"NotebookSecurityOptionsTrustedPath",
"NotebookSecurityOptionsUntrustedPath",
"PalettePath",
"PreferencesPath",
"PrivatePathsAFM",
"PrivatePathsAutoCompletionData",
"PrivatePathsBitmaps",
"PrivatePathsFonts",
"PrivatePathsSystemResources",
"PrivatePathsTextResources",
"PrivatePathsTranslationData",
"SpellingDictionariesPath",
"StyleSheetPath",
"SystemHelpPath"
}


Beware: if you provide the wrong path it crashes Mathematica instantly

Note that path can be things built from FileNameJoin.

## Box edits

### BoxReference

There's a collection of edit mechanisms predicated on FrontEndBoxReference* packets.

These all use FEBoxReference (as far as I've seen). The standard usage of this as I've seen looks like:

FEBoxReference[obj,
{{id}},
FESearchStart->startspec
FEBoxOffset->{offset}
]


Where the options can be dropped.

• obj as far as I can tell is a NotebookObject, CellObject, or BoxObject, but you can also get the current spec from from FEEvaluate@FEPrivateSelf[]
• The id searches for BoxID->id. It can also be FEParent[id]. I don't know what that does.
• The offset should look like FEBoxChild[n] or FEBoxParent[n].
• The only SearchStart values I've seen are "StartFromBeginning" and "StartFromFirstDockedCell".

Here are some usages:

• FrontEndBoxReferenceBoxObject (BoxReferenceBoxObject[boxref])

finds the BoxObject for FEBoxReference

• FrontEndBoxReferenceRead (BoxReferenceRead[boxref])

reads the BoxObject for FEBoxReference

• FrontEndBoxReferenceFind (BoxReferenceFind[boxref])

Selects the BoxObject for FEBoxReference

• FrontEndBoxReferenceReplace (BoxReferenceReplace[boxref,boxes])

Replaces the BoxObject for FEBoxReference

• FrontEndBoxReferenceGetOptions (BoxReferenceGetOptions[boxref, ops]?)

I don't actually know how this one works

• FrontEndBoxReferenceSetOptions (BoxReferenceSetOptions[boxref, ops]?)

Same here

## Keyboard Input

### SimulateKeyPress

This one is weird and I don't really understand it. We'll start with the basic usage:

FrontEndExecute@
FrontEndSimulateKeyPress[
keys:_String|_Symbol|_Integer
];


Any Symbol passed is simply converted to its fully qualified string form (except for System level symbols which simply take their SymbolName), the same is true for integers.

The system then simulates a key press for each character in the string. What is odd is that the characters either all come out as if Shift was held or in their lower-case form. That is, the $FrontEndSession will either come out as $FRONTENDSESSION or as 4frontendsession. I have been unable to figure out what decides this.

Note that holding a modifier has the same effect as if one was typing.

On top of the weirdness with capitalization, there is a second valid usage form:

FrontEndExecute@
FrontEndSimulateKeyPress[
keys:_String|_Symbol|_Integer,
list_List,
___
];


Note that having anything other than a list in the second position does nothing. Oddly, though, I can't figure out what that list is for. Initially I had assumed it was a list of modifier keys. But no set of modifier key strings seems to do anything. In fact I can't find any effect whatsoever of having anything in that list. Note that any argument can follow that list, though. But that second position list is clearly important for something. I just cannot figure out what.

## Cursor click/options

### SimulateMouseMove / SimulateMouseDrag / SimulateMouseClick

SimulateMouseMove moves the mouse to a given screen position. Have yet to find a use for it, but it does allow one to play tricks on a user by putting something like:

Dynamic[
FrontEndExecute@
FrontEndSimulateMouseMove[
$FrontEndSession, MousePosition[] ], UpdateInterval -> 0 ]  in a notebook. There might be an option for moving to a certain named position, e.g., Center but I haven't found it. I just wrote that into a wrapper function. SimulateMouseDrag and SimulateMouseClick are similarly obvious: SimulateMouseDrag takes a list of positions {start, end} and simulates a mouse drag between the two. SimulateMouseClick just clicks on a position. A sample usage: FrontEndExecute@{ FrontEndSimulateMouseDrag[$FrontEndSession,
{{1200, 30}, {1200, 50}}
],
FrontEndSimulateMouseClick[

## Obvious but useful

### NotebookGetLayoutInformation

Provides useful information for anyone working with writing papers in mathematica as it gives access to cell sizes and page break info.

### NotebookDynamicToLiteral

Converts the current dynamic selection to its static displayed form.

### SelectObject

Moves the selection to a given FE object

### SelectedObject

FrontEndExecute@FrontEndSelectedObject[nb] returns whatever objects are selected in a notebook

Provides access to the object hierarchy in a notebook. Particularly useful for getting the boxes in a given cell / box. At the $FrontEnd level though this will give you all notebooks which is useful in and of itself. # A note on GetFEKernelInit A large amount of useful functionality is hidden in here which I simply haven't gotten around to investigating. For example there's this: SystemDeclareKnownSymbols[l_] := MathLinkCallFrontEnd[ FrontEndUpdateKernelSymbolContexts[$Context, FrontEndPrivateResolvedContextPath[],
{{\$Context, {}, {}, l, {}}}]
]


which includes that FrontEndUpdateKernelSymbolContexts which had been crashing my copy of Mathematica repeatedly

You can find the file by:

FrontEndExecute@
FrontEndFindFileOnPath[
"GetFEKernelInit.tr",
"PrivatePathsTextResources"
]


# Warning

Lots of these crash the system if used improperly. For example a bare FrontEndUpdateDynamicObjects or FrontEndUpdateDynamicObjectsSynchronous will crash the system. You have to pass it the results from InternalGetTrackChanges (e.g. Dynamic[a++; InternalGetTrackChanges[]]) which seems to be the Box ID number.

• @Kuba I haven't had time to get back to this. SimulateKeyPress seems to be a more complicated beast than the others. Sometimes it outputs as if Shift is held and sometimes not. As the person who spelunked out AttachCell` you might know better how to deal figure out why it does this. – b3m2a1 Mar 10 '17 at 2:20
• I used this reparsing once, for polishing my mindless approach to metaprogramming: mathematica.stackexchange.com/a/89892/5478 – Kuba May 11 '17 at 10:03
• Thank you a lot, guys. A really great concentration of information I was looking for a long time. Thank you Mr. Wizard, thank you b3m2a1, thank you Kuba. Voted all up! – hieron Nov 3 '18 at 14:28