Ah, hah! Well, that's it then. When you pass a script in the applet tag, it becomes a parameter of the object/applet tag. Those parameters do not preserve line endings -- just like HTML. This was the original reason that Miguel thought it would be difficult to build a model from a scripted model file when I asked him about that in my first question to him. Wow, my first interaction with Jmol!

So the proper way to do this is to make the script a callback that will notify the page that the applet is now ready for loading, and then to send that script using jmolScript().

Voila!

Bob

On Thu, Feb 3, 2011 at 7:38 PM, Jonathan Gutow <gutow@uwosh.edu> wrote:

On Feb 3, 2011, at 2:52 PM, Robert Hanson wrote:


On Wed, Feb 2, 2011 at 12:56 PM, Jonathan Gutow <gutow@uwosh.edu> wrote:

Cool.  What conference exactly?
>
> I did slip that semicolon in somewhere along the way there. So if
> this is your problem, maybe somehow your JavaScript is stripping all
> the newline characters. Not a good idea. Are you perhaps splitting
> on \n and forgetting to put that back in? Something's amiss
> there.... I don't think it's a problem inside Jmol.
That's an idea.  I don't remember doing that, but I only recently came
back to this code after about 4 months off...I'll check.  It makes
some sense because what we actually want to do is store the script as
a hidden div in the page, which can get saved on the server and thus
restore user changes across openings of the page.  This  means that I
did have some massaging to make it work OK in a div.  I think I
replaced all the \n with <br/>.  The idea being that they would then
be replaced with \n before passing back to the applet.  I'm pretty
sure I didn't strip the \n from the backup string version, but I will
check.

That'll do it. I'm sure that's it. The save orientation command does not check to see how many parameters there are, so that next moveto was simply being included on the line of the previous save command. I think if you had used
That doesn't appear to be it.  I can see all the \n in the string using firebug.  I'll keep poking around, but putting the semicolon back in fixed the problem.  I haven't got time right now, but remind me where the script is broken into pieces (Tokens?) and I will try to give it a gander.  Maybe another pair of eyes will find what is going on.  

One clue is that the faulty script string worked fine if I pasted it into the script console of the applet.  The problem only occurred when the string was passed as the script in a call to jmolApplet([width,height], scriptStr, AppletID).

                         Dr. Jonathan H. Gutow
Chemistry Department                                gutow@uwosh.edu
UW-Oshkosh                                          Office: 920-424-1326
800 Algoma Boulevard                                FAX:920-424-2042
Oshkosh, WI 54901
                http://www.uwosh.edu/facstaff/gutow


------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world?
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Jmol-developers mailing list
Jmol-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-developers




--
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