Hi,
thanks Angel, Bob.
I tried it, but (not a show stopper) it only works when I do a setTimeout(...),
e.g.
function myLoadStructCallback(...){
console.log( jmolEvaluate("_modelNumber"), jmolEvaluate("_lastFrame") ); //
prints the frame id shown before the load
setTimeout( function(){
console.log( jmolEvaluate("_modelNumber"), jmolEvaluate("_lastFrame")
); // print the new frame id though the timeout needed may vary depending on
machine and browser...
}, 500)
}
Alex
----- Ursprüngliche Mail -----
> Von: "Robert Hanson" <[email protected]>
> An: [email protected]
> Gesendet: Montag, 12. Juli 2010 17:17:35
> Betreff: Re: [Jmol-users] how to get the jmol file id for a model just loaded
> into an applet
> yes -- Angel has it. The variable is _modelNumber.
>
> In JavaScript:
>
> var currentModel = "" + jmolEvaluate("_modelNumber")
>
> should do it. This should be a string, not a number, since "3.10" is
> different from "3.1". Remember, though, that multiple models can be
> loaded when a file is loaded. I think that's why it's not part of the
> parameter set. Of course, this only applies to the "append" method --
> any straight load command will result in "1.1" for the current model
> number.
>
> Bob
>
>
>
>
> On Mon, Jul 12, 2010 at 8:47 AM, Alexander Rose <
> [email protected] > wrote:
>
>
> Hi,
>
> I would like to get the file id/number (that is file from the
> file.model notation, e.g. "file1.model1) of a model just loaded into
> an Jmol applet. I hoped 'set LoadStructCallback "someJsFunction"'
> would rescue me, but LoadStructCallback gives only the params
> 'appletName, fullPathName, fileName, modelName, ptLoad'. Is there
> another way to get the file id from a just loaded model? Otherwise I'
> like to request a new feature, that is the file id as a new param for
> LoadStructCallback. I can imagine to keep track of the loaded and
> deleted models in javascript alone by using dedicated loading/deleting
> javascript wrappers, but that smells error prone.
>
> Alex
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
>
> --
> Robert M. Hanson
> Professor of Chemistry
> St. Olaf College
> 1520 St. Olaf Ave.
> Northfield, MN 55057
> http://www.stolaf.edu/people/hansonr
> phone: 507-786-3107
>
>
> If nature does not answer first what we want,
> it is better to take what answer we get.
>
> -- Josiah Willard Gibbs, Lecture XXX, Monday, February 5, 1900
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by Sprint
> What will you do first with EVO, the first 4G phone?
> Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users