Bob,

Recently I moved from 12.1.35 to 12.1.43_dev. I am now encountering an 
error in a javascript array search that I have not encountered before. The 
array is searched using Jmol find. I'm going to paste the entire snippet 
below. It is in my usual chaotic style, but the everything appears to be 
working except the Jmol error related to the last line:

function nihNmSm() {
    ETV1 = ""; var nOrS = ""; var smileJs1; nihLoadedAction = 
nihLoadedActionHold; var comID = "";
    if (oChem.models.length == 0) { jmolScript("echo Model not found in the 
local vmk database. Run commands|namenih and smilesnih to query NIH/NCI 
Resolver directly.;etv1=''"); return; }
    jmolScript("fnd = '0';etv1='';etv2 = 'Model not found in local 
database. Run commands namenih|and smilesnih to query NIH/NCI Resolver 
directly.'");
    for (var i = 0; i < oChem.models.length; i++) {
        if (oChem.models[i].form == calcWinTxt) {
            smileJs1 = oChem.models[i].smiJ.replace(/\\/g, '\\\\'); comID = 
oChem.models[i].id; nOrS = oChem.models[i].name;
            if (iupacName == true) { nOrS = oChem.models[i].iupac; } if 
(nihLoadedAction == "getsmiles") { nOrS = 
oChem.models[i].smiJ.replace(/\\/g, '\\\\'); }
            scpt = "cid = '" + comID + "';if (fnd == '0'){var sm2 = '" + 
smileJs1 + "';";
            scpt += "var cks = {*}.find('SMILES',sm2);if (cks > 1){fnd = 
'1'; etv1 = '" + nOrS + "';etv2 = etv1 + '|local vmk database id = ' + cid 
+ ius}}";
            jmolScript(scpt);
        }
    }
    iupacName = false;
    jmolScript('echo @etv2;etv2="";if (fnd == 1){javascript "fbLnk()"}');
}

Here's the console error. It's just related to the last line. From my 
testing, the for loop completes and find does find the db item - i.e. etv2 
contains the correct information. I don't even see the echo, however, 
because of:

Searching Database...
0 atoms selected
14 atoms selected
script compiler ERROR: missing END for if

Do you see what I'm missing in that last line? Again, this has worked in 
12.1.35 and previous.

Otis

--


Otis Rothenberger

Department of Chemistry

Illinois State University
Normal, IL 61790-4160

http://chemagic.org 
------------------------------------------------------------------------------
Fulfilling the Lean Software Promise
Lean software platforms are now widely adopted and the benefits have been 
demonstrated beyond question. Learn why your peers are replacing JEE 
containers with lightweight application servers - and what you can gain 
from the move. http://p.sf.net/sfu/vmware-sfemails
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to