Thanks Bob. That certainly works. So basically anytime I want to pull out some info from the molecule file I need to do that in the jmolApplet command. Or is there a way to do that prior to loading the molecule into Jmol? I'm looking ahead to situations where I'll want to dynamically load a structure into an applet, grab some data out of it and do some stuff with it. Now I'm wondering how I'll be able to update other parts of the web page based on this data if the applet hasn't finished loading the file yet.

Is there a way to find out what properties are accessible from the applet? I'm looking at getting a protein's sequence into an array or a small molecule's energy. If these aren't directly accessible can the entire file be brought into a string variable and then dig the info out of it?

Thanks again.


***********************************************
Jeff Hansen
Department of Chemistry and Biochemistry
DePauw University
602 S. College Ave.
Greencastle, IN 46135
[EMAIL PROTECTED]
***********************************************


On Aug 20, 2008, at 3:43 PM, [EMAIL PROTECTED] wrote:

Message: 4
Date: Wed, 20 Aug 2008 14:42:00 -0500
From: "Robert Hanson" <[EMAIL PROTECTED]>
Subject: Re: [Jmol-users] getting info from Jmol applet
To: [email protected]
Message-ID:
        <[EMAIL PROTECTED]>
Content-Type: text/plain; charset="iso-8859-1"

Jeff,

The mistake here is timing. You cannot query an applet while the page is loading (prior to </body> and completion of applet initialization). In some cases this crashes browsers; in others it just causes an error; in others it
permanently disables the applet communication.

The simple fix is to place the JavaScript code in a function defined in the
<head> block, and then add a JavaScript call to that function in the
start-up Jmol script, after the file is loaded. No need for form tags.

<head>
   <script type="text/javascript">
function appletReady() {
var atomSetArray = jmolGetPropertyAsArray("atomInfo","atomno<5");
alert (atomSetArray[0].info);
}
   </script>
</head>
<body>
   <script type="text/javascript">
     jmolInitialize("jmol");
     jmolApplet(500, "load ../Jmol/jmol/models/1bf3.pdb;javascript
appletReady()");

   </script>
</body>



-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to