Mathematica 9 is now available
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: Simple question sabout setting directory

  • To: mathgroup at smc.vnet.net
  • Subject: [mg51468] Re: Simple question sabout setting directory
  • From: Bill Rowe <readnewsciv at earthlink.net>
  • Date: Tue, 19 Oct 2004 02:55:40 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

On 10/17/04 at 9:49 PM, ds2081 at columbia.edu (Daohua Song) wrote:

>(1)Everytime i load a math.nb file, i want it to set the directory to
>be the same one where the file is. e.g. Once you load c:\math.nb, the
>defalut directory will be set to c:.  (so i can manage the .nb file
>and other data file in the same direcotry )

The following function will return the directory name where the notebook file is stored.

NotebookDirectory[]:=
    DirectoryName@ToFileName["FileName"/.NotebookInformation@EvaluationNotebook[]]

I have this as part of my init.m file that gets executed at the start of every session. Then to achieve what you want all I do is

SetDirectory@NotebookDirectory[]

at the begining of the notebook file

I omitted your second question since it deals with how Mathematica runs under Windows. Since I use a Mac, I've no idea how to achieve the desired response with Windows. On a Mac running OS 10.3 what you want can be achieved with Expose.
--
To reply via email subtract one hundred and four


  • Prev by Date: Plotting two differently scaled graphs together
  • Next by Date: MultipleListPlot without any Point Shape, only with line made by PlotJoined -> True
  • Previous by thread: Re: Simple question sabout setting directory
  • Next by thread: Corrupted file