Bob,

I'm not sure about etv2. I set it up, and then did not use it. The etv1 does work, however. The echo @etv1 message appears first. The next message is the value of etv1. I'm running set debugscript true, so the messages are pretty verbose.

You are correct. I'm using this to pass variables from Jmol to JavaScript. I also use print. There was a reason that I did not use it here, but I don't recall the reason! I'll try print.

Otis

Otis Rothenberger
chemagic.com


On 10/19/2010 8:36 AM, Robert Hanson wrote:
Otis,

Here's a possible culprit. I see:

function processMessage(appNum, msg, indexNum) {
    msg = "" + msg + "";
    if (jmolDebugOn) { memVar1 += msg + "~"; }
    if (getETV2 == true) { ETV2 = msg; getETV2 = false; }
    if (getETV1 == true) { ETV1 = msg; getETV1 = false; }
    if (getSmiles == true) { jmolSmiles = msg; getSmiles = false; }
    if (msg.indexOf("echo @etv1") > -1) { getETV1 = true; }
    if (msg.indexOf("echo @etv2") > -1) { getETV2 = true; }
if (msg.indexOf("print {*}.find('SMILES');") > -1) { getSmiles = true; }
    if (msg.indexOf("assign atom") > -1) { picCenter = true; }
if (msg.indexOf("}) \"C\" {") > -1 || msg.indexOf("assign connect") > -1 || msg.indexOf("new bonds") > -1 || msg.indexOf("assign bond") > -1) { picMinimize = true; picCenter = false; } if (msg.indexOf("Script completed") > -1 && picMinimize == true) { picMinimize = false; doUFF(100); } if (msg.indexOf("Script completed") > -1 && picCenter == true) { picCenter = false; doUFF(2); }
}

Does this code work? I'm pretty sure "echo @etv2" will never be in the msg variable - the script commands are sent in the third parameter -- what you have called "indexNum"

I think I know what you are doing there -- processing messages to set global variables. Rather than setting globals, you could put information in there that identifies the message:


   print "SMILES=" + {*}.find("SMILES")

then look for "SMILES=" in the message callback.

Similarly, I'm guessing your "echo @EVT2" could be replaced by a print command:

print "EVT2=" + whatever

Then reserve ECHO for writing messages to the student on the screen.

Bob


------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev


_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Download new Adobe(R) Flash(R) Builder(TM) 4
The new Adobe(R) Flex(R) 4 and Flash(R) Builder(TM) 4 (formerly 
Flex(R) Builder(TM)) enable the development of rich applications that run
across multiple browsers and platforms. Download your free trials today!
http://p.sf.net/sfu/adobe-dev2dev
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to