From: Alexander R. <ale...@we...> - 2011-03-15 18:19:10
|
Hi, thanks Paul and Bob, you really helped me! I came up with the following: Use a loop in Jmol to watch a file A for changes and execute another file B when changes in file A occur. PREV_FILE_REPL_WATCH_ID = -1 FILE_REPL_WATCH_ID = 0 function file_repl(){ # The file 'watch.txt' needs to contain an # assignment of the variable 'FILE_REPL_WATCH_ID' # (actually it's only need when a change should occur) # The scripts in the files 'watch.txt' and 'script.txt' # are seperated to avoid unnecessary parsing script 'watch.txt'; if( FILE_REPL_WATCH_ID != PREV_FILE_REPL_WATCH_ID ){ print "CHANGED" script 'script.txt' }else{ print "NOT changed" } PREV_FILE_REPL_WATCH_ID = FILE_REPL_WATCH_ID } # Use the 'timeout' command to start watching # timeout "FILE_REPL" -100 "file_repl();" Best Alex ----- Ursprüngliche Mail ----- > Von: "Robert Hanson" <ha...@st...> > An: jmo...@li... > Gesendet: Montag, 14. März 2011 12:52:37 > Betreff: Re: [Jmol-users] Command line communication with the Jmol application? > there's a TimeOut command now. > > > On Mon, Mar 14, 2011 at 4:44 AM, Rolf Huehne < rh...@fl... > > wrote: > > > > On 03/12/2011 05:07 PM, Alexander Rose wrote: > > Hi, > > > > thanks Paul, but that does not describe exactly what I want to do. > > Let me clarify. > > > > I can start Jmol with > > > > java -jar Jmol.jar -s scriptFileName > > > > and everything in 'scriptFileName' gets executed. However, I want to > > start Jmol, execute some Jmol script, feed the results into some > > other program and then execute some more Jmol script based on the > > output of the other program. When I know all the Jmol script I want > > to execute before I start Jmol I can just put it into one script > > file, but I have some Jmol script I want to execute after Jmol has > > been running for a while. It seems this is currently only possible > > by manually using the built-in Jmol Script Console but not > > programmatically via the command line. > > > I think it might be possible by using a loop that tries to load a > second > script file: > > 1) Run first part > 2) Write output and load into external program > 3) Wait until second script file loads successfully > 4) Run second part > 5) Write output > > You should slow down the loop somehow to spare resources. I'm not sure > if there is an actual sleep command but if graphics is enabled you > might > use for example a moveto command which allows to set the time for > execution. > > Regards, > Rolf > > > > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > -- > Robert M. Hanson > Professor of Chemistry > St. Olaf College > 1520 St. Olaf Ave. > Northfield, MN 55057 > http://www.stolaf.edu/people/hansonr > phone: 507-786-3107 > > > If nature does not answer first what we want, > it is better to take what answer we get. > > -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900 > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > Jmol-users mailing list > Jmo...@li... > https://lists.sourceforge.net/lists/listinfo/jmol-users |