Tag Info

Hot answers tagged

5

On Windows this works for me: Pause[1]; 1 + 1 (*you can add Save or Export here ofc*) NotebookSave @ EvaluationNotebook[]; Run["shutdown -t 2 -s"]; NotebookClose[] For command explanation take a look at the link Öskå has provided: SO:162305


3

Last /@ FilterRules[Developer`CellInformation[nb], "Style"] (* {"Title", "Subtitle", "Text"} *) Or SelectionMove[nb, All, Notebook]; "Style" /. Developer`CellInformation[nb] (* {"Title", "Subtitle", "Text"} *) Working with CellObjects: RawBoxes[ToBoxes[#][[1, -1]]] & /@ Cells[nb] (* {"Title", "Subtitle", "Text"} *)


3

You can try SelectionMovelike this: SelectionMove[nb, Next, CellGroup] or SelectionMove[nb, All, CellGroup] one of these should work in your case EDIT: Full Solution for an arbitrary notebook: nb = CreateWindow[ DocumentNotebook[{CellGroup[{TextCell["Text Group", "Section"], TextCell["Mary had a little lamb.", "Text"], TextCell["Its fleece ...


3

a = 108 b::usage = "test usage msg" b[x_] := 4 x + 8 c = Interpolation[{15, 16, 23, 42}] As pointed by OP, the direct usage of FullDefinition produces boxes that are not realy useful. I don't know how to convert them easily without this tiny undocumented function [1], [2]: Save["test.m", {a, b, c}] CreateDocument @ Cell[#, "Input"] &@ First @ ...


2

Something more documented: NotebookRead[ PreviousCell[] ][[2]] "Section" It seems there is something exactly what you need, quite not ready probably since in Experimental` context: Experimental`CellStyleNames[ PreviousCell[] ] "Output" and Experimental`CellStyleNames[] gives you styles of all cells in notebook!, quite useful sometimes. Keep ...


2

It seems there is something you need. Undocumented so who knows. MathLink`CallFrontEnd[ FrontEnd`NotebookImage[ EvaluationNotebook[] ] ]


2

As suggested i post my commend as an answer: I made a bugreport on this (March 27) and got an answer from WRI 3 days later that says: In this case, Mathematica is behaving as designed. In particular, the StyleNames item does not apply to the cells you are looking at. Further, StyleNames is an undocumented symbol, meaning that it's usage can change without ...


2

Using NotebookWrite in this manner is really no different from manually modifying the content of an Output cell. The FrontEnd converts the cell to Input, since it anticipates the user would be interested in evaluating it afterwards. What style is used is determined by DefaultDuplicateCellStyle.


1

I have a possible work around here: Button["date", NotebookWrite[EvaluationCell[], Cell[#, "Output"] &@BoxData@ToBoxes@DateString[]]; SelectionMove[EvaluationNotebook[], Previous, Cell]; CurrentValue[Cells[NotebookSelection[EvaluationNotebook[]]][[1]], StyleNames] = "Subsection"] unforunately i could not test EvaluationBox[] because i have only ...


1

SelectionMove works on CellObjects just like on NotebookObjects: SelectionMove[Cells[nb][[1]], All, Cell]



Only top voted, non community-wiki answers of a minimum length are eligible