MathGroup Archive 2000

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Notional NotebookOpen Nonplus?

  • To: mathgroup at
  • Subject: [mg22299] Re: [mg22294] Notional NotebookOpen Nonplus?
  • From: Andrzej Kozlowski <andrzej at>
  • Date: Thu, 24 Feb 2000 03:01:15 -0500 (EST)
  • Sender: owner-wri-mathgroup at

on 2/23/00 6:01 AM, James Fuite and Tania Nordli at jfuite at

> 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.
The problem is that when you write an expression to a file using Put (>>)
you are not creating a plain text file and not a mathemaitca notebook. You
can only open notebooks with NotebookOpen. Thy saving your notebook with the
front and and then use NotebookOpen. You will see it works fine. Or, if you
insist on using the kernel you can do something like this (substitute yoour
own path name and note that I am using Mathematica 4.0, although there
should be no difference)

nb = NotebookCreate[]; NotebookWrite[nb, "Expand[(a+b)^3]"];
SelectionMove[nb, All, CellContents]; SelectionEvaluate[nb];
NotebookSave[nb,"Macintosh HD:Mathematics:Mathematica:Mathematica 4.0



will do what you wanted.

(There may well be a much better way to do the above, though it seems to me
that by far the simplest way is to Save and Open using the FrontEnd).

  • Prev by Date: Re: Vector and Matrix Differentiation with Mathematica
  • Next by Date: Re: Linux: how compatible with add-ons ?
  • Previous by thread: Re: Notional NotebookOpen Nonplus?
  • Next by thread: Re: Notional NotebookOpen Nonplus?