({{, (RefLink[SelectedNotebook, paclet:ref/SelectedNotebook])[]
gives the currently selected notebook in the front end. }})

OpenersNotesSection(Spacer1)Details

(RefLink[SelectedNotebook, paclet:ref/SelectedNotebook]) returns a (RefLink[NotebookObject, paclet:ref/NotebookObject]).

The currently selected notebook will normally have its title bar highlighted.

The currently selected notebook is the one to which notebook-oriented menu commands in the front end will be directed. Textual commands, however, are directed to the input notebook.

A palette window can be a currently selected notebook but cannot normally be an input notebook.

OpenersPrimaryExamplesSection(Spacer1)Examples  (2)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Give the notebook object for the currently selected notebook:

SelectedNotebook[]

Perform additional operations:

Options[%,WindowSize]

OpenersExampleSection1(Spacer1)Possible Issues  (1)

Both programmed operations and user interactions can change the selected (RefLink[SelectedNotebook, paclet:ref/SelectedNotebook]):

nb=CreateDocument[{a,b,c},WindowTitle->"Other"];

SetSelectedNotebook[EvaluationNotebook[]];Print["The selected notebook is ", SelectedNotebook[], ".\nSelect another notebook..."];
Pause[4];
SelectedNotebook[]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[SetSelectedNotebook, paclet:ref/SetSelectedNotebook])  ▪  (RefLink[Notebooks, paclet:ref/Notebooks])  ▪  (RefLink[InputNotebook, paclet:ref/InputNotebook])  ▪  (RefLink[EvaluationNotebook, paclet:ref/EvaluationNotebook])  ▪  (RefLink[ButtonNotebook, paclet:ref/ButtonNotebook])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[Manipulating Notebooks from the Kernel, paclet:tutorial/ManipulatingNotebooksFromTheKernel])}})}})

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