Alex and Angel,
I think Alex's response is the "textbook" approach, but I've had real problems
with jmolScriptWait. I don't think it's a bug. I just think it's susceptible to
fussy waiting forever (hangs). As an alternative, I find that a call back works
nicely. In the call back function below, the isolated line (marked **) is the
key line. The variable etv1 is a Jmol global. The variable ETV1 is a JavaScript
global. When I have a Jmol script value that I want to pass to JavaScript, I
put it in evt1 and do a "print etv1." The isolated line (marked **) passes the
callback value of etv1 to ETV1. In the function, the passing around of all the
msg1 and msg2 values is a bit convoluted, but it's the only way I know to grab
related msg1 and msg2 information! All the other lines in the function have to
do with automating MINIMIZE during model editing or debug precessing. The key
line at hand is only the isolated line and the msg1 msg2 shuffle.
Convolution aside, it works without hanging problems.
Otis
function processMessage(appNum, msg1, msg2) { msg1 = "" + msg1 + ""; msg2
= "" + msg2 + ""; var num = 50; if (msg2.indexOf(") \"C\" {") < 0 ||
msg2.indexOf("assign connect") > -1) { num = 5; } if ((msg2.indexOf("assign
connect") > -1 && ckModNum() > 1) || msg2.indexOf("}] \"0\"") > -1) { num = 50;
}
**if (msg2Old.indexOf("print etv1") > -1) { ETV1 = msg1; }
if (msg2Old.indexOf("print {*}.find('SMILES')") > -1) { jmolSmiles = msg1;
} if (msg2.indexOf("assign atom") > -1 || msg2.indexOf("assign connect") >
-1 || msg2.indexOf("assign bond") > -1) { doUFF(num); } if (jmolDebugOn) {
memVar1 += msg1 + "~"; memVar2 += msg2 + "~"; } msg1Old = msg1; msg2Old =
msg2;}
--
Otis Rothenberger
Department of Chemistry
Illinois State University
Normal, IL 61790-4160
http://chemagic.org
----------------------------------------
From: "Alexander Rose" <alexander.r...@weirdbyte.de>
Sent: Tuesday, January 25, 2011 7:07 PM
To: jmol-users@lists.sourceforge.net
Subject: Re: [Jmol-users] extract min and max resNo to javascript
Hi,
I think you can build on this:
jmolScriptWait('var foo = "bar";');
var msg = jmolEvaluate( "script('echo @foo');" );
Alex
Am 26.01.2011 um 01:05 schrieb Angel Herráez:
> Hello all
>
> This must be trivial, but I'm stuck
>
> I need to extract the minimum and maximum residue nurmber from a one-chain
> pdb file into
> a Javascript variable.
> The Jmol commands are
> m1 = {*}.resno.min
> m2 = {*}.resno.max
> but I don't know how to pass those to a javascript variable (I need to check
> user input against
> them)
>
> Thanks,
> Angel
>
>
> ------------------------------------------------------------------------------
> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
> Finally, a world-class log management solution at an even better price-free!
> Download using promo code Free_Logger_4_Dev2Dev. Offer expires
> February 28th, so secure your free ArcSight Logger TODAY!
> http://p.sf.net/sfu/arcsight-sfd2d
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)!
Finally, a world-class log management solution at an even better price-free!
Download using promo code Free_Logger_4_Dev2Dev. Offer expires
February 28th, so secure your free ArcSight Logger TODAY!
http://p.sf.net/sfu/arcsight-sfd2d
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users