Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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: [mg50114] Re: How does a notebook get its own filename or directory?
  • From: Joseph Gwinn <JoeGwinn at comcast.net>
  • Date: Sun, 15 Aug 2004 03:15:04 -0400 (EDT)
  • References: <200408130956.FAA03681@smc.vnet.net> <cfk9kp$f4o$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

To all that responded, thanks.  The problem is solved.

I don't know why, but on my system (Mathematica 5.0 on MacOS 10.3), the 
SelectedNotebook[] that many suggested reported on the wrong notebook, 
but EvaluationNotebook[] worked,  so the final code I am using is:

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

This works like a charm.

Thanks,

Joe Gwinn



In article <cfk9kp$f4o$1 at smc.vnet.net>, jmt <jmt at dxdydz.net> wrote:

> The following command will set the Directory to the notebook folder :
> 
> SetDirectory[ DirectoryName[ToFileName[
>       "FileName" /. NotebookInformation[SelectedNotebook[]]]]]
> 
> 
> 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


  • Prev by Date: Re: Re: New user: Abs[] problem
  • Next by Date: Re: 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?