
Hi Tom, Thanks for the reply. The exact use case was to make many entry images for EMDB deposition, where the maps and models for EMDB were organised in individual folders. The advantage of having cd in the script is that I can run the script to load the data, quickly interactively change the scene, and save the image with a simple command ("save map.png") without having to worry about file paths. In practice it's faster to just launch another script that contains a "close all" statement at the beginning with ChimeraX still open then to close and re-open ChimeraX. I realise that this might be a special way to use it, but by analogy to how the cd command works in for example bash scripts I was surprised that it automatically changes back to another directory when the script is completed without receiving another cd command. Anyhow, thanks for the clarification and I can certainly work around this. Best wishes, Matthias Sent from Outlook for Android<https://aka.ms/AAb9ysg> ________________________________ From: Tom Goddard <goddard@sonic.net> Sent: Wednesday, May 29, 2024 2:48:39 AM To: Vorländer,Matthias Kopano <matthias.vorlaender@imp.ac.at> Cc: ChimeraX-users@cgl.ucsf.edu <chimerax-users@cgl.ucsf.edu> Subject: Re: [chimerax-users] Behavior of "cd" when executed through a script 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<mailto:chimerax-users@cgl.ucsf.edu> To unsubscribe send an email to chimerax-users-leave@cgl.ucsf.edu<mailto:chimerax-users-leave@cgl.ucsf.edu> Archives: https://mail.cgl.ucsf.edu/mailman/archives/list/chimerax-users@cgl.ucsf.edu/