Re: Find NotebookDirectory
- To: mathgroup at smc.vnet.net
- Subject: [mg37394] Re: [mg37367] Find NotebookDirectory
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Sat, 26 Oct 2002 02:03:39 -0400 (EDT)
- Organization: "Wolfram Research, Inc."
- Sender: owner-wri-mathgroup at wolfram.com
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.