From: Robert H. <ha...@st...> - 2011-09-27 16:08:00
|
Just so you know, you don't have to use the arguments variable, you can just do this: fucntion msgFn(app, status, msg) { ...do something with msg. } The return would do nothing. Jmol will just ignore it. However, you can use this <JmolScript> print javascript("prompt('testing')") That is, within in Jmol, get the response from a JavaScript prompt and print it. So you could do something like this within Jmol Var x = javascript("msgFn('testing',1,2,3)") and thus deliver that value "2" (based on your function) to the Jmol variable x. Bob On Tue, Sep 27, 2011 at 5:00 AM, Daniel Carbajo <dan...@gm...>wrote: > Just one little more question about this... > Can I return a javascript in the msgFn function that I call > like: jmolSetCallback("MessageCallback","msgFn"); > and use that variable in another normal javascript function? > > Something like: > in javascript: > function msgFn() { > var x = []; > for (var i=0;i<arguments.length;i++) { > x[i] = "" + arguments[i]; > } > return x[2]; > } > > > -- 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 |