MathGroup Archive 2004

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

Search the Archive

Re: How does a notebook get its own filename or directory?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg50077] Re: [mg50061] How does a notebook get its own filename or directory?
  • From: Joe Gwinn <joegwinn at comcast.net>
  • Date: Sat, 14 Aug 2004 01:50:29 -0400 (EDT)
  • References: <200408130956.FAA03681@smc.vnet.net> <200408131406.38980.jmt@dxdydz.net>
  • Sender: owner-wri-mathgroup at wolfram.com

At 2:06 PM +0200 8/13/04, jmt wrote:
>The following command will set the Directory to the notebook folder :
>
>SetDirectory[ DirectoryName[ToFileName[
>       "FileName" /. NotebookInformation[SelectedNotebook[]]]]]

It didn't work, but it gave me the critical hint.  Changing 
SelectedNotebook to EvaluationNotebook did the trick.  So, the final 
code is:

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

Thanks,

Joe

>On 2004 08 13 11:56, Joseph Gwinn wrote:
>   > I like to put multiple datafiles in a subdirectory of the same directory
>   > as the analysis notebook resides.  It would be convenient if this
>   > Mathematica notebook could find these datafiles without help, but
>   > unfortunately I have not figured out how to do this.  Currently, I just
>   > manually put the full pathname in the notebook's code, which works but is
>   > a problem if I move the directory.
>   >
>   > What would solve the problem is if there were a way for a notebook to
>   > obtain the full pathname of the file containing that notebook.  However,
>   > all the directory-related and path-related commands in Mathematica 5.0
>   > seem to be concerned only with the location of the Mathematica kernel and
>   > its libraries, and not at all concerned with the location of the
>   > notebook.  Now, the kernel has to know where the notebook lives, so the
>   > problem is to persuade the kernel to speak.
>   >
>   > Any suggestions?
>   >
>   > Thanks,
>   >
>   > Joe Gwinn
>
>--
>Puissance d'un coton-tige : deux ouates ...


  • Prev by Date: Re: Listplot-Bug in Mathematica 5.0
  • Next by Date: Re: Smalest enclosing circle
  • Previous by thread: Re: How does a notebook get its own filename or directory?
  • Next by thread: Re: How does a notebook get its own filename or directory?