Re: Notional NotebookOpen Nonplus?
- To: mathgroup at smc.vnet.net
- Subject: [mg22306] Re: [mg22294] Notional NotebookOpen Nonplus?
- From: Preston Nichols <pnichols at wittenberg.edu>
- Date: Thu, 24 Feb 2000 03:01:21 -0500 (EST)
- Sender: owner-wri-mathgroup at wolfram.com
James,
Although your file "sample.nb" contains a Mathematica expression and has
the .nb extension, it's not a Notebook!
A Notebook is a file, which, as plain text, consists of a "Notebook
expression":
Notebook[{Cell[...],...}]
and NotebookOpen[] works on files of that form.
One fix might be something like
tmp = Expand[(a + b)^3];
Notebook[{Cell[ToString[InputForm[tmp]], "Output"]}] >>"sample.nb"
But I get the impression that code such as the following is even more "in
the correct spirit" for Notebook manipulation, though it is probably not
verbatim what you'll want to do for your project.
tmpnb = NotebookCreate[];
NotebookWrite[tmpnb, "Expand[(a+b)^3]"];
SelectionMove[tmpnb, Previous, Cell];
SelectionEvaluateCreateCell[tmpnb];
NotebookSave[tmpnb, "sample.nb"]
NotebookClose[tmpnb];
====================================
I hope this helps a little.
Preston Nichols
Mathematics and Computer Science
Wittenberg University
At 01:01 AM 02/23/2000 -0500, James Fuite and Tania Nordli wrote:
>Dear Advanced Mathematica Users,
>
> I am not able to use the function NotebookOpen in Version 3. on
>MacOS 8.1, and after modest investigations, I have to turn to you for
>advice. What follows is an example.
>
>Expand[(a+b)^3] >> "sample.nb"
>NotebookOpen["sample.nb"]
>
> $Failed
>
>!!sample.nb
>
> a^3 + 3*a^2*b + 3*a*b^2 +b^3
>
>So I can look at the file, just not open it. Yet, further probes
>indicate, at least to me, that everything is in order.
>
>Directory[]
>
> Macintosh HD:Mathematica 3.0 Files
>
>MemberQ[FileNames[],"sample.nb"]
>
> True
>
>ToFileName /@ (NotebookPath /. Options[$FrontEnd, NotebookPath])
>
> {Macintosh HD:System Folder:
>Preferences:Mathematica:3.0:FrondEnd:Palettes:,
> etc.,
> :$HomeDirectory:, :$TopDirectory:}
>
>$TopDirectory
>
> Macintosh HD:Mathematica 3.0 Files
>
>It seems to me that the notebook "sample.nb" should be found and
>opened. Suggestions?
>
> Sincerely,
> James J. Fuite.
>
>
>
>