It's because the for was given as the first command of the line. If you
add "echo;" just before it:
echo;for ( var i=5; i>0; i = i - 1); ~cd=i; delay 1; echo @i; end
for;~cd=""
it works fine. Obviously a bug. Should be an easy fix.
I'll update the documentation about the Application command console
needing to have loops like this read from script files or separated by
semicolons, not entered across multiple lines.
Bob
Rolf Huehne wrote:
>Bob Hanson wrote:
>
>
>>Rolf Huehne wrote:
>>
>>
>>
>>>The first thing I noticed was that I had to provide the whole loop
>>>commands in a single line. Distributing it over several lines as in the
>>>example provided in the documentation resulted in the following error
>>>message:
>>>
>>> script compiler ERROR: missing END for for
>>>
>>>My script commands first initialize the echo and then run the countdown:
>>>
>>> set echo myecho 1% 99%; ~cd="Start"; echo %{~cd};
>>> for ( var i=5; i>0; i = i - 1); ~cd=i; delay 1; end for; ~cd="";
>>>
>>>The loop never got beyond displaying "5" and I had to type "quit" in
>>>order to be able to run additional commands.
>>>
>>>
>>>
>>>
>>>
>>The following both work OK in Jmol 11.3.25:
>>
>> for ( var i=5; i>0; i = i - 1); ~cd=i; delay 1; echo @i; end for; ~cd="";
>>
>>
>
>It doesn't work on my system. What I get now is an endless list of "5"
>printed out in the script console window (until I type quit to abort the
> loop).
>
>
>
>> for ( var i=5; i>0; i = i - 1)
>> ~cd=i
>> delay 1
>> echo @i
>> end for
>> ~cd=""
>>
>>
>>
>
>The multi-line version doesn't work in the script console window. Maybe
>this is a difference between loading a script from a file and typing it
>interactively. Until now I thought there was no such difference.
>
>Q: What are the differences between executing a script from a file and
>typing the same commands interactively?
>
>If there really are any differences they should be pointed out in the
>scripting documentation.
>
>
>
>>Of course, without the echo, it just sits there for 5 seconds looping.
>>Maybe that's the problem?
>>
>>
>
>No, this is not the problem. It doesn't sit there only 5 seconds but
>indefinitely until I type "quit".
>Besides I wanted to test the dynamic echo that is bound to a variable.
>(Therefore the "echo %{~cd};" command is in the initializing script
>line.) And this dynamic echo works properly in the "while" loop, so why
>shouldn't it work in the "for" loop?
>
>
>
>>
>>
>>>If I used a "while" loop instead it worked as expected:
>>>
>>> i=5; while (i>0); ~cd=i; delay 1; i = i - 1; end while; ~cd="";
>>>
>>>
>>>While testing this I noticed that the application (in contrast to the
>>>applet) freezes immediately after typing the last letter of the command
>>>"pause".
>>>
>>>
>>>
>>>
>>that's a bug. Introduced in 11.3.10; fixed in Jmol 11.3.26.
>>
>>
>>
>>
>>>---- Test System ----------------
>>>Jmol: 11.3.25, application
>>>Java: 1.5.0_12
>>>OS : Linux, OpenSuSE 10.2
>>>---------------------------------
>>>
>>>
>>>
>
>Regards,
>Rolf
>
>-------------------------------------------------------------------------
>This SF.net email is sponsored by: Microsoft
>Defy all challenges. Microsoft(R) Visual Studio 2005.
>http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>_______________________________________________
>Jmol-users mailing list
>[email protected]
>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: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Jmol-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-users