Cool, this works with a few minor issues:
1) the "set preserveState false" command, when placed in front of the
"getproperty" line wipes out the x variable.
2) when I hit the button that triggers the "x=getproperty("fileContents")"
command the 1st time, the alert is empty; and it's only the second time that
the alert pops up the file contents. Bob's example at
http://chemapps.stolaf.edu/jmol/docs/examples-11/s.htm does not have this
problem.
For reference this is the jmolscript that I used to load a file:
load_script = "zap; load ?; echo waitmessage;select not solvent;
boundbox{selected} on; echo get_bound; set hideNavigationPoint false; set
perspectiveDepth off; set axesMode 0; set axes 3; set frank on; select all;
color chain; center selected; spacefill off; set background black; wireframe
off; select protein; cartoon; select ligand; wireframe 100;color boundbox
red;echo load_success;";
jmolScript(load_script);
load_script="hi = getproperty('fileContents');";
jmolScript(load_script);
alert(jmolEvaluate("hi"))
alert("hi2");
Date: Mon, 22 Feb 2010 13:05:34 -0600
From: [email protected]
To: [email protected]
Subject: Re: [Jmol-users] how to recompile jmolapplet
Just make sure you work within the Jmol scripting system. getPropertyAsString()
bypasses that, as does jmolEvaluate(). You must create a Jmol variable
containing the file contents using the script, then you can access that
variable from JavaScript any time.
The following should work:
load "?"
set preserveState false
x = getproperty("fileContents")
then LATER
javascript:alert(jmolEvaluate("x"))
jmolScript("reset variables")
or anything else that you want to do with that file contents.
I advise also using preserveState false or at least the reset variables just
because otherwise you could have some VERY large states that involve encoding
the variable "x" being created.
Bob
On Mon, Feb 22, 2010 at 12:46 PM, rob yang <[email protected]> wrote:
Hmm, the show files command at jena3D does work well for me. I wonder, though,
that since the jmol file was loaded from server side (as opposed to client
side), that you can pass file contents freely to js scripts.
> Date: Mon, 22 Feb 2010 18:53:19 +0100
> From: [email protected]
> To: [email protected]
> Subject: Re: [Jmol-users] how to recompile jmolapplet
>
> On 02/22/2010 06:33 PM, rob yang wrote:
> >
> >> So you would have to replace the command
> >> 'jmolGetPropertyAsString("image")' by a command to get the file content.
> >>
> >> If you were lucky it would be 'jmolGetPropertyAsString("file")'. I don't
> >> know it. But I am rather sure that there is some way to get the file
> >> information into a Javascript variable.
> >>
> >> The only problem I observed here was the data size. There seems to be
> >> some system dependent security restriction in the amount of data
> >> transferred from Jmol to the browser.
> >
> > Okay, I did try this route, it was jmolGetPropertyAsString("filecontents").
> > As part of the new-age browser security, this was actually not allowed by
> > safari and ff3 either (seems to be independent of length) either although
> > getting the path of the filename was allowed. So it still stands that
> > jmol->server is the only plaussible route for me. Thanks Rolf.
> >
> Does the Jena3D snapshot button work for you in the new-age browsers you
> mean? I didn't observe any problems (except with size) up to Firefox 3.6
> and IE8.
>
> So it is likely the specific way
> 'jmolGetPropertyAsString("filecontents")' works that is the problem. But
> there are other ways to get the file data. There is for example the
> "show file" command. At least with PDB files it displays the whole file
> content. You can try if this works with those browsers by typing the
> command into the script input field within Jena3D. Then the file content
> should be displayed in the log area. It might be clipped there because
> the log area has a size limit. Only the last 'n' log lines are shown.
>
> So with a message callback function that parses the file content out of
> the message stream you should be able to get it into a Javascript
> variable. But there might exist other simpler methods.
>
> Regards,
> Rolf
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
All your Hotmail contacts on your phone. Try it now.
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jmol-users mailing list
[email protected]
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
_________________________________________________________________
Check your Hotmail from your phone.
http://go.microsoft.com/?linkid=9708121------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users