What is the complete list of valid FrontEnd Packet types?

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

MathLink`CallFrontEnd[FrontEnd`NeedCurrentFrontEndSymbolsPacket[]][[1, 1, 4]]

Results from Mathematica 7:

""
"Null"
"CompoundExpression"
"List"
"Execute"
"FrontEndExecute"
"KernelExecute"
"OpenParallelLinksPacket"
"KernelStartupCompleted"
"ReassignInputNamePacket"
"InputNamePacket"
"OutputNamePacket"
"ReturnTextPacket"
"ReturnInputFormPacket"
"ReturnPacket"
"TextPacket"
"DisplayPacket"
"DisplayEndPacket"
"SyntaxPacket"
"InputPacket"
"InputStringPacket"
"ExperimentalInputMouseCoordinatesPacket"
"MenuPacket"
"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"
"SetFileLoadingContext"
"Version"
"VersionNumber"
"DefaultFormatTypeForStyle"
"Notebooks"
"SelectedNotebook"
"SetSelectedNotebook"
"InputNotebook"
"EvaluationNotebook"
"SetEvaluationNotebook"
"ButtonNotebook"
"ClipboardNotebook"
"MessagesNotebook"
"HelpBrowserNotebook"
"DefaultHelpViewerNotebook"
"DebuggerContinue"
"DebuggerContinueToSelection"
"DebuggerSelect"
"DebuggerSetStackList"
"DebuggerSetExpressionColoring"
"DebuggerGetSelectionInformation"
"DebuggerAddBreakpoint"
"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"
"NotebookRead"
"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"
"NotebookSuspendScreenUpdates"
"NotebookResumeScreenUpdates"
"NotebookUpdateScreen"
"SelectNamedObject"
"ReadNamedObject"
"ReplaceNamedObject"
"SelectionApply"
"SelectionCellsMap"
"SelectionCellContentsMap"
"EvaluatePacket"
"SetKernelSymbolContexts"
"UpdateKernelSymbolContexts"
"SetFunctionInformation"
"UpdateDynamicObjects"
"UpdateDynamicObjectsSynchronous"
"AddVariableDefiningFunctions"
"AddUsedToGenerateSideEffectGraphicsFunctions"
"AddFunctionTemplateInformationToFunctions"
"AddOptionInformationToFunctions"
"ControllerBindingsInOutput"
"ReturnDynamicOutput"
"NotebookInformation"
"CellInformation"
"ToFileName"
"SetPersistentFrontEnd"
"GetMenusPacket"
"ResetMenusPacket"
"AddFileBrowserFilterPacket"
"OpenFunctionInspectorPacket"
"GetErrorsInSelectionPacket"
"ErrorIconIsDisplayedPacket"
"UndocumentedTestFEParserPacket"
"UndocumentedGetSelectionPacket"
"UndocumentedBoxInformationPacket"
"UndocumentedBoxStatisticsPacket"
"UndocumentedHangFrontEndPacket"
"UndocumentedCrashFrontEndPacket"
"UndocumentedGetNGraphicsImagePacket"
"UndocumentedGetBoxTypesPacket"
"UndocumentedWhyTheBeepText"
"ReparseBoxStructurePacket"
"AddBoxIDs"
"SetBoxIDs"
"GetBoxIDs"
"RemoveBoxIDs"
"BoxReferenceExists"
"BoxReferenceFind"
"BoxReferenceRead"
"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"
"AddEvaluatorNames"
"AddMenuCommands"
"AddDefaultFontProperties"
"NotebookReleaseHold"
"NotebookDynamicToLiteral"
"NotebookCreateDynamicCaches"
"SelectionAddCellTags"
"SelectionRemoveCellTags"
"SelectionAnimate"
"RegisterConverter"
"ParseFileToLinkPacket"
"DebugTooltipPacket"
"CursorTooltipPacket"
"Install"
"SetJavaParameter"
"FindFileOnPath"
"GetFunctionCategories"
"CopyToClipboard"
"SimulateMouseMove"
"SimulateMouseClick"
"SimulateMouseDrag"
"SimulateKeyPress"
"SimulatedEventPending"
"AttachWindow"
"DetachWindow"
"AttachedWindowRequestingModality"
"AttachedWindowReleasingModality"
"MLFS`Put"
"MLFS`PutAppend"
"MLFS`Get"
"MLFS`OpenRead"
"MLFS`OpenWrite"
"MLFS`OpenAppend"
"MLFS`Close"
"MLFS`StreamPosition"
"MLFS`SetStreamPosition"
"MLFS`Read"
"MLFS`WriteString"
"MLFS`URLDownload"
"MLFS`FileNames"
"MLFS`CopyFile"
"MLFS`RenameFile"
"MLFS`DeleteFile"
"MLFS`FileByteCount"
"MLFS`FileDate"
"MLFS`SetFileDate"
"MLFS`FileType"
"MLFS`CreateDirectory"
"MLFS`DeleteDirectory"
"MLFS`RenameDirectory"
"MLFS`CopyDirectory"
"UpdateNewPrimitiveStyle"
"Plugin`NewNotebook"
"Plugin`OpenNotebook"
"Plugin`CloseNotebook"
"Plugin`Quit"
"Plugin`AssignParent"
"Plugin`SizeNotebook"
"Plugin`RedrawNotebook"
"Plugin`GetContextMenuForNotebook"

Missing from 10.0.2 that were present in 7:

"ButtonCell"
"Plugin`GetContextMenuForNotebook"
"Plugin`RedrawNotebook"

Present in 10.0.2 and not in 7:

"ActivateLicense"
"ApplyStyle"
"AttachCell"
"AttachedCellParent"
"Bib`ChooseCitationStylePacket"
"Bib`DeleteBibliographyPacket"
"Bib`DeleteCitationsPacket"
"Bib`InsertBibliographyPacket"
"Bib`InsertCitationPacket"
"Bib`InsertNotePacket"
"Bib`InsertSpecificCitationPacket"
"Bib`QueryCitationsPacket"
"Bib`QueryCitationStylesPacket"
"Bib`QueryNoteStylesPacket"
"Bib`RebuildBibliographyPacket"
"Bib`RebuildCitationsPacket"
"Bib`RefreshCitationsPacket"
"Bib`RefreshCitationStylesPacket"
"Bib`SetBibNoteStylePacket"
"Bib`SetCitationStylePacket"
"Boxes"
"BoxReferenceBoxObject"
"CA`QueryAutocompletionPacket"
"CDFDeploy"
"CDFInformation"
"Cells"
"CryptoHash"
"DetachCell"
"ErrorMessage"
"EvaluationBox"
"FinishStartup"
"FlushTextResourceCaches"
"ForwardAndHandle"
"GetMouseAppearance"
"LinguisticTranslateCellPacket"
"NewVersionAction"
"NewVersionAvailable"
"NotebookEvaluate"
"NotebookEvaluateReturn"
"NotebookPredictions"
"OptionCompletionsListPacket"
"OptionValuesCompletionsListPacket"
"ParentBox"
"ParentCell"
"ParentNotebook"
"PastePrediction"
"Plugin`KeyDown"
"Plugin`KeyUp"
"Plugin`MouseDown"
"Plugin`MouseMove"
"Plugin`MouseUp"
"Plugin`NotebookFileError"
"Plugin`OpenNotebookStream"
"Plugin`Print"
"Plugin`Save"
"Plugin`SetActiveWindow"
"Plugin`SetViewRegion"
"Plugin`UpdateScrollPosition"
"Plugin`UpdateScrollPositionRelative"
"RewriteExpressionPacket"
"SampleStyle"
"SelectionSetInlineCellOptions"
"SelectionSetPointStyle"
"SelectionSetRectangleRoundingRadius"
"SetMouseAppearance"
"SetNotebookInList"
"StartTaskTiming"
"StartupAction"
"StopTaskTiming"
"SuppressGraphicsHighlight"
"TemplateCachePacket"
"TickleActivation"
"WindowsCodePage"
"WolframCloud`AssignCloudObject"
"WolframCloud`AutomaticCloudLogin"
"WolframCloud`ConnectionAuthorized"
"WolframCloud`ConnectionCancelled"
"WolframCloud`ConnectionEstablished"
"WolframCloud`ConnectionFailed"
"WolframCloud`ConnectionInitiated"
"WolframCloud`ConnectionTerminated"
"WolframCloud`TaskInformation"
"WolframCloud`UploadComplete"
"WolframCloud`UploadFailed"
"WolframCloud`UploadInitiated"

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

"CA`CADumpTriePacket"
"FromFileNameString"
"NotebookGetMisspellingsInStringPacket"
"NotebookGetSpellingSuggestionsPacket"
"NotebookToString"
"RemoveMenuCommands"
"WolframCloud`GenerateFileName"
"WolframCloud`GetAuthentication"
"WolframCloud`Logout"

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[
    FrontEnd`ReparseBoxStructurePacket[
     FrontEndExecute@FrontEnd`NeedCurrentFrontEndSymbolsPacket[] // 
      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.

You can learn more about the supported formats here and here

GetBoundingBoxSizePacket

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

FrontEnd`GetBoundingBoxSizePacket[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

AddUsedToGenerateSideEffectGraphicsFunctions

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

It's used like:

FrontEnd`AddUsedToGenerateSideEffectGraphicsFunctions[
 {
  {context1, 
   {
    function1,
    function2,
    ...
    }
   },
  {context2, 
   {
    function3,
    function4,
    ...
    }
   },
  ...
  }
 ]

As an example you can try:

FrontEndExecute@
 FrontEnd`AddUsedToGenerateSideEffectGraphicsFunctions[
  {
   {"Global`", {"notARealGraphics"}}
   }
  ]

And now if you type:

notARealGraphics[];

that final semicolon will be colored red

AddOptionInformationToFunctions

This is used like AddUsedToGenerateSideEffectGraphicsFunctions:

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

Here's an example:

FrontEndExecute@
 FrontEnd`AddOptionInformationToFunctions[
  {
   {
    "Global`", 
    {
     {"func", {"a", "b", "c"}}
     }
    }
   }
  ]

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


Autocompletion

CA`CADumpTriePacket

Seems to extract data from an autocompletion .trie file:

Used like

FrontEndExecute@
 CA`CADumpTriePacket[trieFile]

e.g.:

FrontEndExecute@
 CA`CADumpTriePacket@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@
 FrontEnd`FindFileOnPath[
  fileName,
  path
  ]

Where path is one of:

{
 "AddOnHelpPath",
 "AutoloadPath",
 "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 FrontEnd`BoxReference* packets.

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

FE`BoxReference[obj,
 {{id}},
 FE`SearchStart->startspec
 FE`BoxOffset->{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 FE`Evaluate@FEPrivate`Self[]
  • The id searches for BoxID->id. It can also be FE`Parent[id]. I don't know what that does.
  • The offset should look like FE`BoxChild[n] or FE`BoxParent[n].
  • The only SearchStart values I've seen are "StartFromBeginning" and "StartFromFirstDockedCell".

Here are some usages:

  • FrontEnd`BoxReferenceBoxObject (BoxReferenceBoxObject[boxref])

    finds the BoxObject for FE`BoxReference

  • FrontEnd`BoxReferenceRead (BoxReferenceRead[boxref])

    reads the BoxObject for FE`BoxReference

  • FrontEnd`BoxReferenceFind (BoxReferenceFind[boxref])

    Selects the BoxObject for FE`BoxReference

  • FrontEnd`BoxReferenceReplace (BoxReferenceReplace[boxref,boxes])

    Replaces the BoxObject for FE`BoxReference

  • FrontEnd`BoxReferenceGetOptions (BoxReferenceGetOptions[boxref, ops]?)

    I don't actually know how this one works

  • FrontEnd`BoxReferenceSetOptions (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@
  FrontEnd`SimulateKeyPress[
   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@
  FrontEnd`SimulateKeyPress[
   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@
  FrontEnd`SimulateMouseMove[
   $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@{
  FrontEnd`SimulateMouseDrag[
    $FrontEndSession,
    {{1200, 30}, {1200, 50}}
    ],
  FrontEnd`SimulateMouseClick[
    $FrontEndSession,
    {1200, 50}
    ]
  }

On my Mac, with screen rectangle of {{4, 1440}, {23, 900}} this drags a window docked at the top right corner down 20 points.

The click is necessary, I found, to get the OS to recognize the mouse drag.

SetMouseAppearance

FrontEndExecute[FrontEnd`SetMouseAppearance[expr_]] sets the mouse appearance

FindAndClickDefaultButton / FindAndClickCancelButton

See this

These find and click the first button with "ButtonType" -> "Cancel" or "ButtonType" -> "Default" in the Appearance list.


Attached cells

AttachedCellParent

This is exactly what you'd expect. Except for 1 big warning. If the CellObject no longer exists it'll crash Mathematica.

AttachCell / DetachCell

Found here

Used as

FrontEndExecute@
 FrontEnd`AttachCell[obj: (_CellObject | _BoxObject | _NotebookObject),
  cellExpr_,
  {
   radialDistanceFromAnchor: (_Integer | _Scaled | "InlineContents"),
   alignment: {Center | Left | Right, Center | Bottom | Top } | "EndOfContents"
   },
  anchor:
   {
    Center | Left | Right | _Scaled | _Integer | _Real | Baseline, 
    Center | Bottom | Top | _Scaled | _Integer | _Real | Baseline
    },
  "ClosingActions"->
   {
    (
     "ParentChanged" | "EvaluatorQuit" |
     "OutsideMouseClick" | "SelectionDeparture" | "MouseExit"|
     "CellGroupOpened"| "CellGroupClosed" ) ...
     }
  ]

From Kuba, when attaching to a notebook using the "ParentChanged" setting will crash Mathematica as detailed here. This also happens when using it with the "InlineContents" and "EndOfContents" anchor and alignments.

FrontEnd`DetachCell simply detaches an attached cell.


Menu edits

AddMenuCommands

Described here

Used as

FrontEndExecute@
 FrontEnd`AddMenuCommands[menu,{items}]

where menu is the target menu and items are MenuItem/Item expressions or `Delimiter.

See also: https://mathematica.stackexchange.com/a/6227/38205

Which shows how to do this with a "MenuList*" menu.

ResetMenusPacket

This can be used to both reset the menus and set an arbitrary Menu structure.

Used as:

FrontEndExecute@
 ResetMenusPacket[{menu}]

where menu is either a Menu expression looking like

Menu["Mathematica", {menu_items_and_submenus}]

or Automatic as far as I've discovered. I'm sure there are more use cases but these are the ones I've found.

More info here


Cell Groups

SetCellGroupOpen

In the "FEPrivate`" context. Allows one to set the open/close state of a cell group. Called like:

MathLink`CallFrontEnd@
 FrontEnd`Value@
  FEPrivate`SetCellGroupOpen[
   cell,
   Open|Close|True|False
   ] 

Open/True and Close/False are the same thing.

Any other spec will return $Failed (which prevents it from being used to set up Dynamic open/closers)


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@FrontEnd`SelectedObject[nb] returns whatever objects are selected in a notebook

ObjectChildren

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:

System`DeclareKnownSymbols[l_] :=
 MathLink`CallFrontEnd[
  FrontEnd`UpdateKernelSymbolContexts[
   $Context, FrontEnd`Private`ResolvedContextPath[], 
   {{$Context, {}, {}, l, {}}}]
  ]

which includes that FrontEnd`UpdateKernelSymbolContexts which had been crashing my copy of Mathematica repeatedly

You can find the file by:

FrontEndExecute@
 FrontEnd`FindFileOnPath[
  "GetFEKernelInit.tr",
  "PrivatePathsTextResources"
 ]

Warning

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