Server 6.6.1 and Multi-Line "put"

Igor de Oliveira Couto igor at semperuna.com
Mon Apr 28 21:48:59 EDT 2014


Dear LiveCode Gurus,

Looking at the following blog post, it looks like LiveCode could be a great tool for producing more easily understandable and maintainable command-line tools:

http://livecode.com/blog/2014/03/06/livecode-server/

Prompted by that, I am trying to create a LiveCode shell script, which will be run under the commercial version of LiveCode server, 6.6.1. My script will need to respond to several commands - ie., ‘help’ - by outputting several lines of information to the Terminal. I am finding, however, that Server is choking if I create text programatically that contains a ‘return’ character. Example:

—
#! path/to/livecode/server

put “Hello World!” & return & “Hello Galaxy!”
—

Seems to output *only* “Hello Galaxy!”. It’s as if the terminal is ignoring the previous line, and outputting only the last. 

Doing the following yields the same result:

—
#! path/to/livecode/server

put “Hello World!”
put return
put “Hello Galaxy!”
—

I *can* get the Server to output several lines if I get it to *parse a text file* directly to the Terminal. For instance: if I put the following text in a plain-text file…:

—
Hello World!
Hello Galaxy!
—

…and call this file “plaintext.lc”, and then get the server to parse it to the Terminal, by using…:

—
$: /path/to/livecode/server plaintext.lc
—

Then I *do* get both lines of text.

I then tried to build a test script that just outputs the result of one of the built-in functions that return multiple lines - such as:

—
#! path/to/livecode/server

put the folders
—

This seem to produce garbled output to the Terminal - it actually looks as if the lines of the result were all overwritten on top of each other.

From the blog posting above, it clearly looks as if I should be able to do this rather simple task, but I’m stumped. I’m starting to think that maybe 6.6.1 is not the version that was used in the sample script shown in the blog - perhaps a developer preview of 7.0, which handles unicode differently, is being used, and this could account for the difference in behaviour. In any case, from my end it seems to be impossible for me to write a script like the one being shown.

Is this perhaps something stupid I’m doing at my end? Or is it really a 6.6.1->7.0 issue?

Any guidance would be much appreciated.

Kindest regards to all,

--
Igor Couto
Sydney, Australia




More information about the use-livecode mailing list