From: Robert H. <ha...@st...> - 2009-06-29 15:05:04
|
On Mon, Jun 29, 2009 at 8:53 AM, Brian McMahon <bm...@iu...> wrote: > Hello > > I have a model loaded into a Jmol applet sitting in an HTML page. > I wish to populate a JavaScript variable with the current value of the > ellipsoid probability (as set, e.g. by "ellipsoids 50") when I open > a fresh tab on that page, via an onClick method. How can I most easily > retrieve that value? > > So far I have > > 'onClick': function(argsObj) { > var stateInfo=jmolGetPropertyAsString("stateInfo") > alert(stateInfo) > return true; > } > var stateInfo= jmolEvaluate('getProperty("stateInfo").lines.find("Ellipsoids")') > > which pops up an alert showing the entire current state (in which > "Ellipsoids 50" appears). Where the alert is called I guess I could parse > the stateInfo string and assign the desired value to my variable. Is there > a > more direct way, e.g. by analogy with the modelInfo.modelCount method > of the methodInfo array as shown on the Jmol scripts documentation page? > > var modelInfo = jmolGetPropertyAsArray("modelInfo") > alert(modelInfo.modelCount) > > Thanks > Brian > _________________________________________________________________________ > Brian McMahon tel: +44 1244 342878 > Research and Development Officer fax: +44 1244 314888 > International Union of Crystallography e-mail: bm...@iu... > 5 Abbey Square, Chester CH1 2HU, England > > > ------------------------------------------------------------------------------ > _______________________________________________ > 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 |