Bob,

Some naiveté on my part here: I had to use my specific object jmolApplet0. I do 
not know how to translate the object Viewer to JavaScript. Also, I don't 
understand the final Escape.escape(bs). I'll avoid explicitly stating the 
obvious laugh line on this latter point. Jmol returns the first line as the 
file name. I simply used the string "string," which I think Jmol returns for an 
edited model. Finally, Jmol seems to have a condensed date following the final 
Jmol version in the third line. Since I do not see this in you email code, I 
did not include this.

Having said this, I think I got the date formatting correct. Here's the 
JavaScript (encased in function for my testing ease):


        function test() {
                
                var mol = "string";
                var version = Jmol.getPropertyAsArray(jmolApplet0, 
"appletInfo.version")
                var c = new Date();
                mol += "\n__Jmol-" + version.substring(0,2);
                mol += String("_0" + (1 + c.getMonth())).slice(-3);
                mol += String("0" + (c.getDate())).slice(-2);
                mol += String(c.getFullYear()).substring(2,4);
                mol += String("0" + (c.getHours())).slice(-2);
                mol += String("0" + (c.getMinutes())).slice(-2);
                mol += "3D 1   1.00000     0.00000     0";
                mol += "\nJmol version " + version + " EXTRACT: ";
                alert(mol);
        }


--
Otis Rothenberger
o...@chemagic.com
http://chemagic.com




On Jan 12, 2013, at 8:54 AM, Otis Rothenberger wrote:

> Bob,
> 
> I get the basic flow of what's happening below, so I'll try. My JavaScript is 
> pretty primitive and chaotic, so you'll have considerable clean up to do!
> 
> Otis
> 
> --
> Otis Rothenberger
> o...@chemagic.com
> http://chemagic.com
> 
> On Jan 11, 2013, at 10:47 AM, Robert Hanson wrote:
> 
>> That will take a bit of work. I seem to have missed that. What we are doing 
>> there is setting up the MOL file date line. Maybe you can help me by writing 
>> the JavaScript equivalent of this:
>> 
>>     StringXBuilder mol = new StringXBuilder();
>>       String version = Viewer.getJmolVersion();
>>       Calendar c = Calendar.getInstance();
>>       mol.append("\n__Jmol-").append(version.substring(0, 2));
>>       TextFormat.rFill(mol, "_00", "" + (1 + c.get(Calendar.MONTH)));
>>       TextFormat.rFill(mol, "00", "" + c.get(Calendar.DAY_OF_MONTH));
>>       mol.append(("" + c.get(Calendar.YEAR)).substring(2, 4));
>>       TextFormat.rFill(mol, "00", "" + c.get(Calendar.HOUR_OF_DAY));
>>       TextFormat.rFill(mol, "00", "" + c.get(Calendar.MINUTE));
>>       mol.append("3D 1   1.00000     0.00000     0");
>>       //       This line has the format:
>>       //  IIPPPPPPPPMMDDYYHHmmddSSssssssssssEEEEEEEEEEEERRRRRR
>>       //  A2<--A8--><---A10-->A2I2<--F10.5-><---F12.5--><-I6->
>>       mol.append("\nJmol version ").append(Viewer.getJmolVersion()).append(
>>           " EXTRACT: ").append(Escape.escape(bs)).append("\n");
>> 
>> 
>> Bob
>> 
>> 
>> On Thu, Jan 10, 2013 at 12:58 PM, Otis Rothenberger <osrot...@chemagic.com> 
>> wrote:
>> Bob,
>> 
>> With JSmol, I'm getting an error message that I don't understand. I'm 
>> getting the same message in different contexts:
>> 
>> TypeError: 'undefined' is not an object (evaluating 
>> 'java.util.Calendar.getInstance') 58490 
>> http://chemagic.com/JSmol/j2s/core/core.z.js
>> 
>> Most recently, I get this with:
>> 
>> set picking ON;set atomPicking ON;set picking assignAtom_C
>> 
>> I do NOT get this error if I put it into your Test2 page. In my own page, I 
>> get the error on my first click. After that all seems OK.
>> 
>> In the past, I got this same error when I tried to use getPropertyAsString 
>> to extract the molfile. In this case, I cannot get the extracted molfile.
>> 
>> Does anything obvious come to mind on this error message?
>> 
>> I should mention that I am currently using pre model kit mode pick callback 
>> code to replace atoms until I find the nature of this problem.
>> 
>> Otis
>> 
>> --
>> Otis Rothenberger
>> o...@chemagic.com
>> http://chemagic.com
>> 
>> 
>> 

------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122912
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to