MathGroup Archive 2002

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

Search the Archive

Re: define working directory by the file opened

  • To: mathgroup at smc.vnet.net
  • Subject: [mg38468] Re: define working directory by the file opened
  • From: Nigel King <king at dircon.co.uk>
  • Date: Wed, 18 Dec 2002 01:54:01 -0500 (EST)
  • References: <atjutf$lrk$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

In <atjutf$lrk$1 at smc.vnet.net> ilan wrote:
> I am using mathematica in windows,
> I want that when I'm open a file by mouse clicking it will change the
> working directory of mathematica to the directory of the file, so if I
> will save data with save (without define to where),it will be saved in
> the directory of the open file automaticaly.
> thanks

I have in my initialisations file init.m
$ThisNotebookDirectory := 
    ToFileName[NotebookInformation[
SelectedNotebook[]][[1, 2, 1]]];

And in my notebooks that need the required feature I put the follwoing 
line in the initialisation
SetDirectory[$ThisNotebookDirectory];

I thnk this should work on any platform

nigel king


  • Prev by Date: portable issues with zip files
  • Next by Date: Re: using strings to create variables
  • Previous by thread: define working directory by the file opened
  • Next by thread: Re: define working directory by the file opened