From: Ian T. <th...@cc...> - 2009-04-15 10:05:38
|
Hi Angel, Angel Herráez wrote: > In my experience, the only safe solution is to have Jmol call the > javascript, and to include that call in the jmolApplet() call itself. > > So, it could be something like > > jmolApplet(300, 'load myFile.cif; javascript "parseAtoms()"; ') > I tried what you suggested but I still have the same intermittent problem: sometimes the call to jmolGetPropertyAsArray("atomInfo", "all") returns nothing, presumably because Jmol has not finished initialising at that point. Other times, I do get a property array back, but the inidividual objects within the array don't have an 'info' property for some reason, so my function still fails but in a different place. It seems that even if I call my javascript function from within the Jmol scripting layer itself, it still doesn't seem to run in a synchronised fashion. I even tried setting my function as a callback: set LoadStructCallback "jmol_update_disorder()"; I assumed this would guarantee that my javascript wouldn't run until after Jmol has finished loading the molcule, but sadly this too suffers from the same intermittent problem. Is this an example of a more general Jmol scripting problem? Unless anyone has any other suggestions, it appears I will have to abandon my new functionality completely as I'm out of ideas and I cannot get it to work reliably. :-( Thanks for your help, Ian LEGAL NOTICE Unless expressly stated otherwise, information contained in this message is confidential. If this message is not intended for you, please inform pos...@cc... and delete the message. The Cambridge Crystallographic Data Centre is a company Limited by Guarantee and a Registered Charity. Registered in England No. 2155347 Registered Charity No. 800579 Registered office 12 Union Road, Cambridge CB2 1EZ. |