Hi Matthias,

  When you open a ChimeraX command file (.cxc) ChimeraX changes the current directory to the directory that the script is in, and then when the script ends it changes the current directory back to the original current directory.  This is a feature.  It allows one command script in a directory to call another command script in the same directory without having to specify a path to that script (e.g. "open script2.cxc"), and when the script ends you are in the original directory (e.g. the directory with some data files).

  I think the way you are trying to use it is unusual.  I guess there could be an open command option that lets you tell it not to restore, or maybe not set or restore the directory.  This sound like something no one but you would ever use, so I can't say it is too likely we would add that option.

  I'm also a bit baffled why you are changing the current directory in a script file.  If you have a command script that is specific to a set of data files I think it is most common to put the script file in the same directory as those data files.  And if scripts and data are in a directory, it is most common that you change to that directory in ChimeraX (cd /where/my/data/is) or you start ChimeraX in that directory (usually on Linux from a shell).

Tom


On May 27, 2024, at 6:49 AM, Vorländer,Matthias Kopano via ChimeraX-users <chimerax-users@cgl.ucsf.edu> wrote:

Dear ChimeraX team, 
 
I have a series of scripts that contain a “cd” statement to set the working directory. I execute the scripts (which opens a model and map and colors the map). I then manually adjust the orientation and threshold and want to save a picture with “save map.png” (I want this png tp be saved in the folder that I set with the script). I have noticed that in this scenario ChimeraX has “forgotten” the cd statement from the script file and has fallen back to default working directory (or the last working directory manually set in the session before I exectuted my script). At least for me it would be more convenient and logical if the working directory can be set and maintained after habing executed a script.
Note: if I don’t execute the script by double clicking but by copy/paste, the working directory is correctly maintained.
Would be great if the behavior could be adjusted 😊
 
Many thanks and best wishes,
Matthias
_______________________________________________
ChimeraX-users mailing list -- chimerax-users@cgl.ucsf.edu
To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu
Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/