Must use 11.6.rc11

Sent from my iPhone

On Aug 29, 2008, at 10:14 AM, Jeff Hansen <[EMAIL PROTECTED]> wrote:

I spoke too soon.

var x = jmolEvaluate('getProperty("auxiliaryInfo.zeroPoint")')


isn't working for me. It returns an error message about the getProperty command.



***********************************************
Jeff Hansen
Department of Chemistry and Biochemistry
DePauw University
602 S. College Ave.
Greencastle, IN 46135
[EMAIL PROTECTED]
***********************************************


On Aug 29, 2008, at 10:40 AM, Robert Hanson wrote:

mosty I think you will find that the jmolGetStatus() business won't be helpful. I'm probably the only who ever used that. It was an early attempt to get around callbacks, and I can't think of any good reason to use it now.

Try something else, like the following:

alert(jmolGetPropertyAsString("auxiliaryinfo", "", divInc))


For getting that property, these days I just use:

var x = jmolEvaluate('getProperty("auxiliaryInfo.zeroPoint")')

rather than doing all the translation of the auxiliaryInfo array into JavaScript just to get that one element.

But you are using Jmol 11.6.RC6 -- be sure to upgrade that to 11.6.RC11.

Bob







On Thu, Aug 28, 2008 at 11:00 PM, Jeff Hansen <[EMAIL PROTECTED]> wrote: Thanks Bob. If gas prices weren't so high and my family wouldn't miss me too much I would take you up on the offer.

Of course jmolScriptWait didn't break anything, just my failed attempts to use it broke something.

I tried your second alternative (callbacks are still a mystery to me although that code doesn't look too bad). So after loading the file I called a function.

this.loadString = "load ../Jmol/jmol/Models/" + molecule + ";javascript myFunc();";
        divWrite(divID,jmolApplet(400, this.loadString,divInc));

In the function I tried to use jmolGetStatus.

function myFunc(){
        var result = jmolGetStatus("scriptStatus",divInc);
        alert(result);
}

As with all of my attempts thus far this displayed "undefined." I guess I still don't get how this works.

I think ultimately I will put the load command along with some other commands in a script file rather than continuing to make these long (and going to get longer) strings.

I'm making progress and having fun.  Does that make me a geek?

Thanks for the help and encouragement.

You can see how far I've come at http://web.mac.com/jhansen4/Jmol/NewJmolDivSTD.html .


Jeff

***********************************************
Jeff Hansen
Department of Chemistry and Biochemistry
DePauw University
602 S. College Ave.
Greencastle, IN 46135
[EMAIL PROTECTED]
***********************************************


On Aug 28, 2008, at 10:47 PM, Robert Hanson wrote:

Jeff, why don't you come over to St. Olaf and I'll show you how this works! :) Seriously, hang in there. You are trying to do a lot all at once, and you will catch on. This is precisely what this list is for. Just keep at it.

"jmolScriptWait" would not "break" anything.

jmolScriptWait should only be used if you absolutely have to pause the JavaScript until that operation is complete. There are times this is necessary, but it's not a great idea.

Most Jmol commands are given "asynchronously" using jmolScript() rather than jmolScriptWait(). Jmol has a built-in queuing system, so you can fire as many commands at it as you wish, and they will be processed in order as processing becomes available. You can also clear the queue using

  !exit

and you can abort a specifically running script (but continue processing later scripts) using

  !quit

An alternative to waiting is to have the issued script notify the web page when it is complete. Eric Martz and Tim Driscoll masterminded this idea using "scriptcallback" methods that see a comment go by and then know it is time to do something. Something like this:

set scriptcallback "myfunc";set debugscript true;load whatever;#--file is loaded

then myfunc() gets a message every time a script command is executed, and the "#--file is loaded" message comes through as well:

function myfunc(app, msg) {
var s = "" + msg // converts Java string msg into a JavaScript string
  if (s.indexOf("#--file is loaded") == 0) {
    [do something]
  }
}


Alternatively, I've used the following quite effectively:

  jmolScript("load whatever;javascript modelLoaded()")

That would run the JavaScript function

function modelLoaded() {

}

as soon as the model is loaded.

Basically, good "event driven" code is asynchronous. Nothing waits for anything. Things happen because they get a message that they need to happen. The more you can do that, the better.

Still, I do use jmolScriptWait() myself at times. Also jmolEvaluate() is synchronous, and I use that a lot as well.

Bob





On Thu, Aug 28, 2008 at 6:30 PM, Jeff Hansen <[EMAIL PROTECTED]> wrote:
I tried jmolScriptWait but couldn't get it to not break the load
command.


***********************************************
Jeff Hansen
Department of Chemistry and Biochemistry
DePauw University
602 S. College Ave.
Greencastle, IN 46135
[EMAIL PROTECTED]
***********************************************


On Aug 28, 2008, at 6:03 PM, Jeff Hansen wrote:

> Sorry I wasn't clear about this, but the applet corresponding to
> result1 is loaded when the page loads. I'll try jmolScriptWait to see
> if that does anything for the result2.
>
> fffff
> ***********************************************
> Jeff Hansen
> Department of Chemistry and Biochemistry
> DePauw University
> 602 S. College Ave.
> Greencastle, IN 46135
> [EMAIL PROTECTED]
> ***********************************************
>
>
> On Aug 28, 2008, at 5:41 PM, Angel Herráez wrote:
>
>> On 28 Aug 2008 at 15:59, Jeff Hansen wrote:
>>
>>> Additionally, the alert(result1) (see code below) displays undefined >>> in the alert box and alert(result2) displays a blank alert box. So
>>> I'm wondering what is going on with that.
>>
>> I would say that with result1 you are trying to read from the applet
>> before it has been
>> created, so it's not surprising thayt you get undefined.
>> As for result2, I'm not sure because I don't know the try/catch
>> command, but anyway it may
>> be too soon to have the applet ready. Javascript goes much faster
>> than loading Java +
>> Jmol.
>>
>>
>>
>> --- --- ------------------------------------------------------------------- >> This SF.Net email is sponsored by the Moblin Your Move Developer's
>> challenge
>> Build the coolest Linux based applications with Moblin SDK & win
>> great prizes
>> Grand prize is a trip for two to an Open Source event anywhere in
>> the world
>> http://moblin-contest.org/redirect.php?banner_id=100&url=/
>> _______________________________________________
>> Jmol-users mailing list
>> Jmol-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
>
>
> --- --- -------------------------------------------------------------------
> This SF.Net email is sponsored by the Moblin Your Move Developer's
> challenge
> Build the coolest Linux based applications with Moblin SDK & win
> great prizes
> Grand prize is a trip for two to an Open Source event anywhere in
> the world
> http://moblin-contest.org/redirect.php?banner_id=100&url=/
> _______________________________________________
> Jmol-users mailing list
> Jmol-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/jmol-users


--- --- ------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users



--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users


--- --- ------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users




--
Robert M. Hanson
Professor of Chemistry
St. Olaf College
Northfield, MN
http://www.stolaf.edu/people/hansonr


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 the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

--- ---------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Jmol-users mailing list
Jmol-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to