> I was thinking about this a little more. The standard solution to this 
> problem is to set up a callback. You can do this very simply just be using
> 
>     set messageCallback "somefunctionname"
> 
> and then at the end of your script, or whenever you want to be sure you 
> are synchronized, just have in your script at that point
> 
>   echo APPLET_DONE
> 
> When the callback comes, your callback method does the boundbox call, 
> and everything is synched.

Thanks Bob. This works, with some minor issues. This is what I end up doing:
---
var load_script = "zap; load somestructure; boundbox{all} on; set frank on; 
some other commands"
jmolScript(load_script+'set messageCallback "temp_function";');

function temp_function() {
    var property = getPropertyAsString("boundboxInfo");
    alert("just for debugging" + property); //this is just for debugging, and 
is not part of the final code
}
---
The above code gets the right value to the variable property, which is exactly 
what I need. But the temp_function gets called many times because messages are 
sent each time a jmol command completes. It's not big deal, but just out of 
curiosity, is there anyway to turn off the message or clear callbacks? For 
example, after the boundbox call, I don't have to respond to the remaining 
commands. Instead of "set messageCallback", I also tried loadStructCallback, 
but it didn't seem to help. In fact it's worse because for some reason property 
takes on the value "null".
Also, for my own reference, how would I call temp_function with parameters? 


> OR, better, you can do it in one go -- just have the echo something like 
> this:
> 
>  refresh; echo  @{"The Boundbox is now " + getproperty("boundboxInfo")}
> 
> The @{} construct allows building of the parameter on the fly. In this 
> way you get the message you need when you need it. No threading issues. 
> I don't know if the refresh is needed -- try with and without. The point 
> is that callbacks have proven to be very reliable, and since you design 
> your own message, that's really about all one needs.

This solution seems to be more elegant. But it only echos everything to the 
applet window, or at least, I couldn't figure out how to store it to a variable.

Once again, thank you very much, Bob.

-Rob


_________________________________________________________________
Try Chicktionary, a game that tests how many words you can form from the 
letters given. Find this and more puzzles at Live Search Games!
http://g.msn.ca/ca55/207
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users

Reply via email to