MathGroup Archive 2002

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

Search the Archive

Re: Find NotebookDirectory


On Fri, 25 Oct 2002, [utf-8] Artūras Acus wrote:

> I am looking for the simplest way to find EvaluationNotebook[]
> directory. The solution should work in all operating
> systems. For example solution bellow, works fine on Linux, but appears 
> don't on Windows95/98 (Mathematica 4.1).
> 
> StringDrop[DirectoryName[ToString[EvaluationNotebook[ ]]],17]

Here is a platform independent approach that uses the undocumented 
function NotebookInformation[].

ToFileName["FileName" /. NotebookInformation[EvaluationNotebook[]]]

Bear in mind that if the notebook has not been saved with a file name, 
then the result will be the string "FileName".  A robust solution would 
include checking for this pathological situation.

-- 
P.J. Hinton
User Interface Programmer                         paulh at wolfram.com
Wolfram Research, Inc.
Disclaimer: Opinions expressed herein are those of the author alone.



  • Prev by Date: Direct tensor algebra
  • Next by Date: Re: Different EPS exported file from frontend and kernel
  • Previous by thread: Re: Find NotebookDirectory
  • Next by thread: What constitutes a complete set of 4.2 Documentation?