Re: define working directory by the file opened
- To: mathgroup at smc.vnet.net
- Subject: [mg38536] Re: define working directory by the file opened
- From: iselig at techunix.technion.ac.il (ilan)
- Date: Sun, 22 Dec 2002 04:14:13 -0500 (EST)
- References: <atjutf$lrk$1@smc.vnet.net> <atp6ja$8vd$1@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Nigel King <king at dircon.co.uk> wrote in message news:<atp6ja$8vd$1 at smc.vnet.net>... > 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 1.where should I put the lines (in which init.m or in which directory)? 2.can I write there or anywhere else the command: (SetDirectory[$ThisNotebookDirectory];) so when the notebook arise it will be defined already. thanks ilan