From: Jonathan G. <gu...@uw...> - 2009-12-18 05:40:19
|
Anybody see what I'm doing wrong? var stateStr = jmolGetPropertyAsString("stateInfo", "all", n); ...stuff to build a popup jmolApplet("100%", scriptStr, jmol_count); This seems OK until it gets to the inline data in the script, then it fails with the warning that it can't find the file. The problem lines of the state script seem to be data "inline data" empty 10 Xx ## ## ## Xx ##... ... ... end "inline data" The warning returns "empty10Xx ## ## ..." as the offending line. This looks like a problem with the script parser looking for linefeeds or returns, but I haven't been able to fix it by adding or replacing linefeeds and returns. Interestingly, if I replace all linefeeds in the script with <br>, write it to another <div> on the page and then copy the script to a plain vanilla text editor and then copy it into the console of a new applet it works fine. Trying to use the script in the <div> instead of directly passing the string doesn't work either. Any ideas? Thanks, Jonathan Dr. Jonathan H. Gutow Chemistry Department gu...@uw... UW-Oshkosh Office:920-424-1326 800 Algoma Boulevard FAX:920-424-2042 Oshkosh, WI 54901 http://www.uwosh.edu/facstaff/gutow |
From: Angel H. <ang...@ua...> - 2009-12-18 10:28:04
|
Inline data and newlines tend to eb asource of trouble... Jonathan, have you checked it's not a quotes problem? |
From: Otis R. <ot...@ch...> - 2009-12-18 14:16:44
|
Jonathan- > Any ideas? > I had exactly the same problem. I finally used the following approach to "copy/paste" state from one applet to another in Jmol 11.9.9. I do not use jmol.js, so some of the function calls may seem strange to you. Nevertheless, I think that the basic concept below is readable. One Note: Some time is needed between "copy" and "paste." I use user lag time in making a transfer manually. For automatic transfer, you may need to use a JavaScript setTimeout delay between "copy" and "paste." Use show state to pass state as a message: function copyMol() { if (feedbackFlag) { feedback(r[9]); } // Relevant to my page only. evalRasmol("select *"); // My script eval function. Its name is obviously historic! evalRasmol("show state;delay 2;"); mepsData["tempHold"] = mepsData[jmol1]; // Relevant to my page only. } Use message call back function to put state info into global variable jmolVar1. Use a variable - not hidden field. Hidden fields gave me problems - probably CR/LF issues. They may be hidden, but they seem to insert platform specific line info: function processMessage(appNum, messageString, indexNum) { if (messageString.indexOf("function _setWindowState() {") > -1) { jmolVar1 = messageString + ""; } } Put state info in new Jmol applet: function pasteMol() { if (feedbackFlag) { feedback(r[9]); } // Relevant to my page only. evalRasmol("select *"); evalRasmol(jmolVar1); } Best Regards Otis -- Otis Rothenberger http://chemagic.org |
From: Robert H. <ha...@st...> - 2009-12-18 15:21:44
|
Interesting. "inline data" is not a recognized data header. I'm surprised Jmol is saving that in the state. What version of Jmol is this? (Could be a difference with 11.8 vs. 11.6, I suppose.) generally to get the data you would use var data = jmolScriptWait("show data") Bob On Thu, Dec 17, 2009 at 10:39 PM, Jonathan Gutow <gu...@uw...> wrote: > Anybody see what I'm doing wrong? > > var stateStr = jmolGetPropertyAsString("stateInfo", "all", n); > ...stuff to build a popup > jmolApplet("100%", scriptStr, jmol_count); > > This seems OK until it gets to the inline data in the script, then it > fails with the warning that it can't find the file. > > The problem lines of the state script seem to be > > data "inline data" > empty > 10 > Xx ## ## ## > Xx ##... > ... > ... > end "inline data" > > The warning returns "empty10Xx ## ## ..." as the offending line. > > This looks like a problem with the script parser looking for linefeeds > or returns, but I haven't been able to fix it by adding or replacing > linefeeds and returns. Interestingly, if I replace all linefeeds in > the script with <br>, write it to another <div> on the page and then > copy the script to a plain vanilla text editor and then copy it into > the console of a new applet it works fine. Trying to use the script > in the <div> instead of directly passing the string doesn't work either. > > Any ideas? > > Thanks, > Jonathan > > Dr. Jonathan H. Gutow > Chemistry Department gu...@uw... > UW-Oshkosh Office:920-424-1326 > 800 Algoma Boulevard FAX:920-424-2042 > Oshkosh, WI 54901 > http://www.uwosh.edu/facstaff/gutow > > > > > > > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-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 |