Thanks Alexander (and Bob). What a neat trick!
Just for the record, my context was a Jmol variable, etv, that was set
in a JavaScript loop that used Jmol FIND to locate a SMILES in a
JavaScript array. A subsequent:
jmolScriptWait('var foo = etv;'); msg = jmolEvaluate("script('echo
@foo;echo;')");
alert(msg);
works beautifully. The second echo is just to make the first echo disappear.
Otis
Otis Rothenberger
chemagic.com
On 11/25/2010 4:57 AM, Alexander Rose wrote:
> Hi,
>
> Bob recently showed me you can use script with evaluate, i.e.
>
> jmolScriptWait('var foo = "bar";');
> var msg = jmolEvaluate( "script('echo @foo');" );
> console.log(msg);
>
> this should print 'bar' to your browser console
>
>
> Best
> Alex
>
> ----- Ursprüngliche Mail -----
>> Von: "Otis Rothenberger"<[email protected]>
>> An: [email protected]
>> Gesendet: Donnerstag, 25. November 2010 07:56:54
>> Betreff: [Jmol-users] Jmol Variables
>> Bob,
>>
>> Are there any Jmol string variable manipulation methods? Specifically,
>> can you calculate the wrap of long echo via script manipulation of the
>> echo string?
>>
>> Actually, a more ideal route would be to pass the Jmol variable to a
>> JavaScript variable and display the information by some JavaScript
>> route. When I do this via a callback function, I have to invoke
>> JavaScript timeouts to work with the JavaScript variable that picked
>> up
>> the Jmol script variable in the callback. If I don't wait a second or
>> two, the JavaScript string is empty. These timeouts can lead to
>> problems, and I'd like to lose them. In your opinion, what's the best
>> way to take a Jmol script variable and pass it to JavaScript for
>> subsequent Web page display, preferably without use of a timeout.
>>
>> Otis
>>
>> --
>> Otis Rothenberger
>> chemagic.com
>>
>>
>>
>>
>> ------------------------------------------------------------------------------
>> Increase Visibility of Your 3D Game App& Earn a Chance To Win $500!
>> Tap into the largest installed PC base& get more eyes on your game by
>> optimizing for Intel(R) Graphics Technology. Get started today with
>> the
>> Intel(R) Software Partner Program. Five $500 cash prizes are up for
>> grabs.
>> http://p.sf.net/sfu/intelisp-dev2dev
>> _______________________________________________
>> Jmol-users mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/jmol-users
> ------------------------------------------------------------------------------
> Increase Visibility of Your 3D Game App& Earn a Chance To Win $500!
> Tap into the largest installed PC base& get more eyes on your game by
> optimizing for Intel(R) Graphics Technology. Get started today with the
> Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
> http://p.sf.net/sfu/intelisp-dev2dev
> _______________________________________________
> Jmol-users mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/jmol-users
------------------------------------------------------------------------------
Increase Visibility of Your 3D Game App & Earn a Chance To Win $500!
Tap into the largest installed PC base & get more eyes on your game by
optimizing for Intel(R) Graphics Technology. Get started today with the
Intel(R) Software Partner Program. Five $500 cash prizes are up for grabs.
http://p.sf.net/sfu/intelisp-dev2dev
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users