New answers tagged

4

FrontEndTokenExecute[nb, "EvaluateNotebook"] does not return anything, it won't wait for a nb to finish evaluating. If it worked I think it was a coincidence. Compare those examples: The first one is analogous to your approach. procedure1[] := Module[{nb}, nb = NotebookPut @ Notebook[ Table[ Cell[BoxData@MakeBoxes[Print[#]; Pause[1];], "Input"...


2

A self-closing dialog window using NotebookDynamicExpression selfclose1[content_, closetime_] := CreateDialog[ Column[{ content, CancelButton[ImageSize -> Full]}], NotebookDynamicExpression -> Dynamic[Refresh[ If[Clock[closetime, closetime, 1] == closetime, NotebookClose[]], UpdateInterval -> closetime, TrackedSymbols :&...


0

On Mac OS X, you can open the files directly from the operating system: Navigate to the folder containing all the documentation files (which you can find by running NotebookDirectory[] within any one of the pages). Open as many notebooks as you would like.


2

This is what I understood OP needs: SetAttributes[foo, HoldFirst]; foo[proc_] := Module[{dialog}, dialog = MessageDialog["whatever"]; RunScheduledTask[NotebookClose @ dialog, {3}]; proc] a more advanced example can be found in Palette button with progress bar


5

Borrowing some of the display-related code for TransformationFunction[], I came up with this: MakeBoxes[PartitionedMatrixForm[M_, {p_Integer, q_Integer}], fmt_] ^:= Module[{mat}, mat = If[Unevaluated[M] =!= {{}} && MatrixQ[Unevaluated[M]] && And @@ MapThread[0 <= Abs[#2] <= #1 - 1 &, {Dimensions[M], {p,...


3

Indeed, the existing notebook can be called repeatedly from another notebook, which iterates over the desired parameters, passing them to the existing notebook, which then passes the answers back to the calling notebook, which records them. For instance, begin the calling notebook with Dynamic[{loop, linked`vdtdz}] distab = {}; Dynamic[distab // TableForm] ...


2

Oh, sorry everyone. I've got an answer here right after I posted my answer...... But I think this solution may be helpful for other users annoyed with Pause: new = CreateDialog[Plot[x^2, {x, 0, 1}]]; PrintTemporary@DynamicModule[{t = Now, check = True}, Dynamic[ If[check && Now - t >= Quantity[3, "Seconds"], NotebookClose[new]; ...


5

It can done in OS X, but AFAIK only from a previously open Documentation Center notebook. If you have one open, then you can do it this way. Run your mouse cursor over any hyperlink in the Documentation Center notebook. Bring up the context menu. (right-click or ctrl-left-click) Select Open in New Window.


2

The gap in the first example may be controlled with the Option CellFrameMargins. This can be done for one cell at a time or by creating a custom Style Sheet. Either is assisted by use of the Option Inspector. Selecting your Title cell (use the selection bracket to its right), then opening the Option Inspector and searching for CellFrameMargins should show ...


4

You may use the Low-Level Notebook Programming guide. Create a notebook with CreateDocument for the example that has duplicate cells. SeedRandom[123]; nb = CreateDocument[Table[ExpressionCell[n, "Input"], {n, RandomInteger[{1, 5}, 20]}]] The Cells can be GatherBy'ed their NotebookRead representation. They will have different CellChangeTimes so this is ...


0

I tried to do this, and ended up with some of the functionality you want. The idea I pursued was to create a copy (from a non-maximized window because I don't know how to programmatically resize a maximized one): copy[original_] := Module[{copy = NotebookPut[NotebookGet[original]], size = WindowSize /. AbsoluteOptions[original, ...


0

I don't think directly getting/setting the scroll position from a function is possible within Mathematica alone. You could conceivably call external programs to screenshot and locate the scroll, and program the mouse to click on a certain position on the scroll bar, but Mathematica alone cannot do this. To get the scroll position using a mouse, you could ...


0

I think the most likely candidate for the "buried Option" is SpanMaxSize. Please tell me what this looks like on your system: Format[paren[obj_]] := Style[DisplayForm @ RowBox[{"(", obj, ")"}], SpanMaxSize -> Infinity] paren @ Column @ {1, 2, 3} Also please try: Format[paren2[obj_]] := Style[DisplayForm@RowBox[{"(", obj, ")"}], SpanMaxSize -&...


0

First set the caseNumber to be 0, will loop the following code: If[Head[caseNumber] === Symbol, caseNumber = 0;] caseNumber += 1; Pause[0.5]; Print["Current Iteration: ", caseNumber] Which[caseNumber == 1, dataString = "Jan", caseNumber == 2, dataString = "Feb", caseNumber == 3, dataString = "March", caseNumber == 4, dataString = "April", caseNumber =...


4

This is operating system dependent. On OS X (my OS), Mathematica comes with a Quick Look plug-in. When installed it provides exactly the service you are asking for. All I have to do is select the notebook's icon in a Finder window an hit Space


1

Temporary setting: SetOptions[$FrontEndSession, "ShowCellBracket" -> False] Fixed setting: SetOptions[$FrontEndSession, "ShowCellBracket" -> False] Only for a given notebook: SetOptions[nb, "ShowCellBracket" -> False]


0

Per george2079's recommendation and Yves Klett's reference to How to build and operate a master Notebook?, I think this is better closed as a duplicate or not at all, since it is a slight extension of the linked Q&A. There may be times when iterating a notebook is useful. At this time, it's hard for me to imagine how the computation wouldn't be better ...


13

You may use the "DocumentationExampleInputs" property of the "WolframLanguageSymbol" entity or WolframLanguageData function. With "WolframLanguageSymbol" entity: EntityValue[Entity["WolframLanguageSymbol", "Round"], "DocumentationExampleInputs"] For more than one at a time you can use "EntityAssociation" to have the entities as keys. EntityValue[...


7

You can use DumpSave["state.mx", "Global`"] to put all the defined variables/symbols in a given instance into a file. Then you can afterwards reload that with Get["state.mx"]. This is probably the most 'portable state' form you can get for moving a notebook's loaded data to another computer, without moving the source data.


0

NotebookSave /@ Notebooks[]; or NotebookSave /@ Select[Notebooks[], (AbsoluteCurrentValue[#, WindowTitle] != "Messages") &]; to avoid saving the Messages notebook.


0

Based on my answer at Referencing cells after reopening a saved notebook, get a list of all output cell expressions with outputs = ToExpression[#, StandardForm, Defer] & @@@ (NotebookRead /@ Cells[CellStyle -> "Output"]); then export via Export["outputs.pdf", Column[outputs], "PDF"];


3

Alternatively, if you want to use Mathematica, then you can do something like so-- dir="path/to/directory"; SetDirectory[dir]; fn = FileNames[]; (* select just .nb files, so you don't import and other files, etc. *) notebooks = StringCases[fn, ___ ~~ ".nb"] // Flatten; (* select the notebooks that you want *) Select[ notebooks, StringMatchQ[ ...


2

I would simply execute grep -He '\\<Sin\\>' *.nb in a command shell (with the appropriate working directory). You might be able to do this within Mathematica, but I doubt it would be worth the trouble.


1

While SelectionMove[EvaluationNotebook[], All, Notebook] returns $Failed you can use: NotebookDelete @ Cells[]



Top 50 recent answers are included