Re: Directory of the open notebook
- To: mathgroup at smc.vnet.net
- Subject: [mg20941] Re: Directory of the open notebook
- From: "P.J. Hinton" <paulh at wolfram.com>
- Date: Wed, 1 Dec 1999 01:50:09 -0500 (EST)
- Organization: "Wolfram Research, Inc."
- References: <812ahm$1h8@smc.vnet.net> <81a0a4$8oe@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
On 21 Nov 1999, P.J. Hinton wrote: > In article <812ahm$1h8 at smc.vnet.net>, "Tom De Vries" <tdevries at shop.westworld.ca> writes: > > >I was wondering how to find out the directory of the > >selected notebook? > > This little snippet will return a string with the full path to the > notebook, provided that it has been saved to a file. > > DirectoryName[ > ToFileName["FileName" /. NotebookInformation[EvaluationNotebook[]]]] > > NotebookInformation[] is documented in Glynn & Gray, I believe. One little compatibility note needs to be brought up. The code shown above should work for Mathematica 4, but in Mathematica 3.0.x under Windows, you will need to do something a little different: ToFileName[ First["FileName" /. NotebookInformation[EvaluationNotebook[]] ] /. $RootDirectory->""] The reason is that the 3.0.x front end and kernel have different ideas of what $RootDirectory should be. -- P.J. Hinton Mathematica Programming Group paulh at wolfram.com Wolfram Research, Inc. Disclaimer: Opinions expressed herein are those of the author alone.