If you look at org.jmol.applet.Jmol.java you will find examples of using
scriptWait and script:

    case SCRIPT_WAIT:
      return viewer.scriptWait(script);
    case SCRIPT_NOWAIT:
    default:
      return viewer.script(script);

This does exactly what you are looking for. The return is the result of
output going to a String buffer.

Bob


On Wed, Feb 6, 2013 at 5:42 PM, N David Brown <hubd...@gmail.com> wrote:

> Looking at AppConsole I don't think there is a way to obtain a reference
> to the execThread used because it's package protected (I write this
> nervously considering our last visibility modifier conversation haha).
>
> It'd be nice to have the methods
>
> execute(String)
> executeCommandAsThread(String)
>
> return the ExecuteCommandThread instance instantiated, or else null if
> none is.
>
> That would allow for the parent application to wait until the thread has
> completed.
>
> David
>
>
> On 6 February 2013 23:36, N David Brown <hubd...@gmail.com> wrote:
>
> Hmm if I don't use loadInline then I can't immediately retrieve the
>> molecule from the viewer.
>>
>> Is there a callback mechanism for the loading method you recommended, or
>> a way to sleep the current thread until that thread has completed?
>>
>> David
>>
>>
>> On 6 February 2013 23:28, N David Brown <hubd...@gmail.com> wrote:
>>
>> Sorry - mol is a JmolMolecule instance retrieved from a Viewer instance
>>> like so: myViewer.getModelSet().getMolecules[i].
>>>
>>> Thanks for the tip Bob. So if I call a load command of that format
>>> using AppConsole#execute it will be thread-safe?
>>>
>>> David
>>>
>>>  On 6 February 2013 22:52, Robert Hanson <hans...@stolaf.edu> wrote:
>>>
>>>> I have no idea. What's "mol" ?
>>>>
>>>> By the way, loadInLine is not thread-safe. It is much better to use a
>>>> script and just enter the data as:
>>>>
>>>> load DATA "model mydata"
>>>> .....mol data here...
>>>> end "model mydata" .... more load parameters here....
>>>>
>>>>
>>>>
>>>> On Wed, Feb 6, 2013 at 4:17 PM, N David Brown <hubd...@gmail.com>wrote:
>>>>
>>>>> After importing a structure of N atoms from molfile format using
>>>>> Viewer#loadInline:
>>>>>
>>>>> System.out.println(mol.atomCount); // 0
>>>>> System.out.println(mol.nodes.length); // N
>>>>>
>>>>> Why is atomCount zero?
>>>>>
>>>>> David
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Free Next-Gen Firewall Hardware Offer
>>>>> Buy your Sophos next-gen firewall before the end March 2013
>>>>> and get the hardware for free! Learn more.
>>>>> http://p.sf.net/sfu/sophos-d2d-feb
>>>>> _______________________________________________
>>>>> Jmol-developers mailing list
>>>>> Jmol-developers@lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/jmol-developers
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Robert M. Hanson
>>>> Larson-Anderson Professor of Chemistry
>>>> Chair, Chemistry Department
>>>> 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
>>>>
>>>>
>>>


-- 
Robert M. Hanson
Larson-Anderson Professor of Chemistry
Chair, Chemistry Department
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
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013 
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers

Reply via email to