Feature Requests item #2837721, was opened at 2009-08-14 10:40 Message generated for change (Comment added) made by hansonr You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379136&aid=2837721&group_id=23629
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed Priority: 5 Private: No Submitted By: Christopher King (popnose) Assigned to: Nobody/Anonymous (nobody) Summary: Use relative address in state files Initial Comment: On one computer, a file, 1edn.pdb, was opened. The state was saved as 1edn.spt in the same directory as 1edn.pdb. Both files were transferred to the same directory on another computer. On that computer, the state file gave an error because the directory structure was different than on the original computer. Can the state file be changed to use a relative address for the original file? Then, I could transfer state files from office to classroom and not have to worry as much about having the same directory structure. ---------------------------------------------------------------------- >Comment By: Bob Hanson (hansonr) Date: 2009-09-03 17:15 Message: OK, this is done. See Jmol 11.9.2 (http://chemapps.stolaf.edu/jmol/docs/examples-11/Jmol-11.zip and http://chemapps.stolaf.edu/jmol/docs/examples-11/new.htm) There are two new options for SCRIPT and WRITE STATE commands. These are LOCALPATH and REMOTEPATH. Each takes an argument in quotes. Setting the LOCALPATH replaces any file reference in the script, either on reading or writing, to that path; setting REMOTEPATH does the same for anything with an "http" "https" or "ftp" prefix. So, for example, if you have a state that refers to files on a local file system and now you want to run it but load files from a different system, you would do something like this: script LOCALPATH "" "myfile.spt" That says, "whatever the local file path to a file accessed by this script command, (in LOAD or SCRIPT commands, for example), make them come from the current directory. (This might be on a web host or another local machine.) script LOCALPATH "data" "myfile.spt" would set all local file references to data/.... If the file reference already contains .../data/... in its path, then it is simply truncated to data/.... Same for REMOTEPATH, but here we are changing only the remote file references. So, for example, if you had used load =1crn and then saved the script as "myfile.spt", that script will have in it: load "http://rcsb.org/pdb/files/1crn.pdb" So, say now I have that file on disk and don't want to go back to the server for it. Then I just say: script REMOTEPATH "" "myfile.spt" This will now read 1crn.pdb from the local drive but otherwise run the same. Bob Hanson ---------------------------------------------------------------------- Comment By: Christopher King (popnose) Date: 2009-08-26 15:42 Message: One approach would be to compare the paths of the script and the data files. How about this? If the operating system is windows then Are the two files on the same drive? If no, do nothing. If yes, does the data file’s path begin with the script file’s path? Script in C:\Work\ , data in C:\Work\Data\. If yes, remove the script’s path from the start of the data file’s path. That turns the data file’s path into a relative path. Data file path: data\ If no, find the relative path. Script in C:\Work\Figures\; Data in C:\Work\Data\ Remove the drive from the path strings Script in \Work\Figures\; Data in \Work\Data\ Is the remaining top-level directory present in both strings? If yes, remove it Script in Figures\; Data in Data\ Repeat until the common top-level directories have been removed If no, add “..\” to the data file’s path for each remaining directory in the script file’s path Data file’s path becomes “..\Figures\” Now you’ve got a relative path to the data file from the script file’s directory. (The ..\ means go up one directory level.) ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-08-24 12:00 Message: quick work-arounds --- 1) save files on a flash drive, and check that both machines assign the same drive letter to the drive 2) save files on the web. 3) edit the spt files to remove the C:/xxx/xxx/ part of the file directory. 4) write a small script that first reads the script file into a variable using the load() function, makes the character replacements using replace(), then runs the script using the script() function rather than the script command. 5) load pdb files using the "=" default RCSB prefix. (load =1edn) This may be a bit slower, but it ensures getting the same file at least. I know -- not totally satisfying. But any of these might work. The problem is figuring out how to specify the correct working directory, and whether that change should be in the state file or in the reading of it. Bob ---------------------------------------------------------------------- Comment By: Bob Hanson (hansonr) Date: 2009-08-23 00:56 Message: So far I haven't figured out a simple way to do this. Suggestions welcome. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=379136&aid=2837721&group_id=23629 ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Jmol-developers mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/jmol-developers
