From: Robert H. <ha...@st...> - 2010-10-19 11:54:31
|
On Mon, Oct 18, 2010 at 11:57 PM, Otis Rothenberger <osr...@ch...>wrote: > Bob, > > I found the jmolScriptWait(scpt) documentation on the jmol.js > documentation page. I had problems implementing it. There's something > I'm not getting right in my attempts. > > BUT > > Your terminal Jmol JavaScript command appears to be the solution to my > problem. One by one, I'm able to remove these timeouts using this > approach. I do need to rework my Jmol script strings, however. That > terminal javascript command needs double quotes. > > yes it does. > Unfortunately, one timeout that I can't seem to eliminate is the one on > the original applet load script. > > APPLET_LOAD_STUFF;javascript "getFormula()" will not work. > > Is that because it is Jmol calling JavaScript calling Jmol? When you say, "will not work" -- why is that? I'd like to reproduce that. What do I need to do? > APPLET_LOAD_STUFF;javascript "jmolInit()" works. > > jmolInit() simply calls getFormula() via a timeout. > > Unfortunately again, this is probably the cause of that random load > error. One solution to this is eliminating getFormula() on an initial > applet load. The same default model always loads, and I can supply this > as string without the jmolScript calls in getFormula. > > > Otis > > Otis Rothenberger > chemagic.com > > > On 10/18/2010 10:30 AM, Otis Rothenberger wrote: > > Bob, > > > > I know that I need to try to get rid of those JavaScript timeouts. The > > construct jmolScriptWait(scpt) sounds interesting. I'm not familiar with > > it. In the following example, what is jmolScriptWait(scpt) waiting for? > > Is it that scpt does not execute until all of the subsequent JavaScript > > executes? > > > > jmolScriptWait(scpt); > > mepsData = true; > > if (moData) { > > toolMenu() > > } else { > > editMenu() > > } > > getFormula() > > > > Most of my timeouts are used with my getFormula() or a context similar > > to my getFormula(). To reduce these timeouts to their essence, here is > > what's going on: > > > > 1) jmolScript related to model changing is fired in a JavaScript > > function via jmolScript() - i.e. model kit editing. > > IN SUBSEQUENT getFormula() > > 2) jmolGetPropertyAsArray("moleculeInfo.mf") is fired. > > 3) jmolScript making use of message call back to get new SMILES for > > JavaScript global variable is fired. > > > > I know that 2 and 3 must wait for 1 to complete. I think the order of 2 > > and 3 is irrelevant - not sure?? I'd sure like to lose setTimeOut as the > > referee that keep these guys in order. Will jmolScriptWait() do this? > > > > Otis > > > > Otis Rothenberger > > chemagic.com > > > > > > > > > > > ------------------------------------------------------------------------------ > > Download new Adobe(R) Flash(R) Builder(TM) 4 > > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly > > Flex(R) Builder(TM)) enable the development of rich applications that run > > across multiple browsers and platforms. Download your free trials today! > > http://p.sf.net/sfu/adobe-dev2dev > > _______________________________________________ > > Jmol-users mailing list > > Jmo...@li... > > https://lists.sourceforge.net/lists/listinfo/jmol-users > > > > > > > ------------------------------------------------------------------------------ > Download new Adobe(R) Flash(R) Builder(TM) 4 > The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly > Flex(R) Builder(TM)) enable the development of rich applications that run > across multiple browsers and platforms. Download your free trials today! > http://p.sf.net/sfu/adobe-dev2dev > _______________________________________________ > 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 |