Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ClearAll[myPrint];
- myPrint[exp_] := Module[{dir, fns, nb},
- dir = NotebookDirectory[];
- fns = FileNames[FileNameJoin[{dir, "myMessagesTemp.nb"}]];
- If[fns === {},
- nb = CreateNotebook[];
- NotebookSave[nb, FileNameJoin[{dir, "myMessagesTemp.nb"}]],
- nb = NotebookOpen[fns[[1]]]
- ];
- NotebookWrite[nb, Cell[exp, "Output"]]
- ]
- Module[{},
- myPrint["Hello World"];
- myPrint["Hello Again"];
- Do[myPrint[n], {n, 4}]
- Do[myPrint[ToString[n]], {n, 4}]
- myPrint[x^2];
- ]
Add Comment
Please, Sign In to add comment