Hi Yingjie,

Robert had an interesting idea - I've never thought of that. I think
what he means is that you assemble a URL to your pythonscript in
JmolScript and then fire that with a load command to the server.

[JmolScript]
load "http://www.myserver.com/cgi-bin/myscript.py?atoms=1+2+3+4+5"; ;
[/JmolScript]

and then

[python code]
...
import cgi
formdata = cgi.SvFormContentDict()
atoms = formdata["atoms"].split()
#atoms should now be a list of strings: ["1", "2", "3", "4", "5"]
...
[/python code]

Then it is up to you if the script should return an actual structure
that is then loaded by Jmol or not.

If your plan is to forward the user to a different page I believe you
can also fire a JavaScript from within the JmolApplet:

[JmolScript]
javascript 
"window.location.href='http://www.myserver.com/cgi-bin/myscript.py?atoms=1+2+3+4+5'
;" ;
[/JmolScript]

This should forward the browser to the given URL and with the python
code mentioned above you can then deliver appropriate HTML code back
to the browser.



About jmolEvaluate: There I don't know what is going on. I've never
used it and have no template at hand where I could test it. Maybe try
updating Jmol to a newer release.
What also might be interesing to know: What OS are you using? As you
mentioned Safari, I suspect you have a Mac?

Have any of the Mac users on this list have experienced
incompatibilities with jmolEvaluate() ?


Oliver

On Wed, Mar 23, 2011 at 22:51, Yingjie Lin <yingjie....@mssm.edu> wrote:
> Hi Robert,
>
> Do you mean that I can pass a value from Jmol back to the server by having
> the following?
> jmolScript("load ...", 0)
>
> But I am a bit confused. I though the load() function is used to load data
> from a file into Jmol.
> How should I pass a variable back to the server with it?
>
> Thank you.
>
> Yingjie
>
> Message: 6
>
> Date: Wed, 23 Mar 2011 19:08:47 -0500
>
> From: Robert Hanson <hans...@stolaf.edu>
>
> Subject: Re: [Jmol-users] Problem while writing state to file in
>
> JmolApplet
>
> To: jmol-users@lists.sourceforge.net
>
> Message-ID:
>
> <aanlktinr-ymhgsyejcpaaxuzukfbalhuut2rxru7g...@mail.gmail.com>
>
> Content-Type: text/plain; charset="iso-8859-1"
>
> That said, think about your overall information model. The most efficient
>
> use of Jmol is via calculations in the client using JavaScript or even just
>
> JmolScript.
>
> On Wed, Mar 23, 2011 at 7:07 PM, Robert Hanson <hans...@stolaf.edu> wrote:
>
> You can also just use the applet itself to pass data back to the server.
>
> Just use the load() function in Jmol script. No need for AJAX with that.
>
> Remember, AJAX was designed with JavaScript in mind, not Java. Java already
>
> has the capability to communicate with your server.
>
> Bob
>
>
> On Tue, Mar 22, 2011 at 5:21 PM, Oliver Stueker <
>
> revilo2...@users.sourceforge.net> wrote:
>
> Hi Yingjie,
>
> keep in mind that the Jmol Applet is executed inside the Browser of
>
> the user whereas your python script runs on the webserver.
>
> So you'll need to communicate data from the client back to the server.
>
> The first step would be passing the data that you need from the
>
> Java-Applet into the JavaScript (inside the Browser).
>
> This can be done by e.g. PickCallbacks (or similar) or you can
>
> probably assign the content of the state-file to a JavaScript variable
>
> (as a string).
>
> The second step would be to pass that information back to the webserver.
>
> With JavaScript you can assign the data you want to transfer to a
>
> <input type="hidden"> inside a <form ... method="post"> which will
>
> send the data to the server when the form is submitted. If using a
>
> form is too Web 1.0 for you, I'm sure you can also use an AJAX
>
> framework to send the data to the server.
>
> Oliver
>
> On Tue, Mar 22, 2011 at 15:47, Yingjie Lin <yingjie....@mssm.edu> wrote:
>
> Hi Jmol users,
>
> I am developing a web server with Jmol Applet (Jmol version 12.0.22). I
>
> need
>
> the user to select a set of atoms by, say, coloring them red. When the
>
> user
>
> is done selecting and is ready to move on to the next page, I would like
>
> my
>
> Python script to know which atoms are selected.
>
> I think this could be done by saving the Jmol display to a file, using
>
> "write STATE filename.spt". This works perfectly in the Jmol program
>
> itself, but I couldn't get it to work in Jmol Applet. In Jmol Applet,
>
> there
>
> is no error message, but no file is written, and the content of the
>
> state
>
> file is printed to the Console.
>
> Does anyone know what I am missing here?
>
> Thank you.
>
> Yingjie
>
>
> ------------------------------------------------------------------------------
> Enable your software for Intel(R) Active Management Technology to meet the
> growing manageability and security demands of your customers. Businesses
> are taking advantage of Intel(R) vPro (TM) technology - will your software
> be a part of the solution? Download the Intel(R) Manageability Checker
> today! http://p.sf.net/sfu/intel-dev2devmar
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>

------------------------------------------------------------------------------
Enable your software for Intel(R) Active Management Technology to meet the
growing manageability and security demands of your customers. Businesses
are taking advantage of Intel(R) vPro (TM) technology - will your software 
be a part of the solution? Download the Intel(R) Manageability Checker 
today! http://p.sf.net/sfu/intel-dev2devmar
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to