Server 6.6.1 and Multi-Line "put"

Peter W A Wood peterwawood at gmail.com
Mon Apr 28 22:43:14 EDT 2014


Igor

I think the answer is to set the ouputLineEndings to an appropriate value. Here is a script that work on OS X.

<?lc
    set the outputLineEndings to "lf"
    put "Hello World!" && the date && the time & return & "Goodbye" & return
?>

It happily prints Goodbye on a new line.

I suspect that this is only an issue on OS X as the default line ending in the engine for Macs is still be the pre-OS standard which was cr. May be one of the gurus knows for sure.

Regards

Peter


On 29 Apr 2014, at 09:48, Igor de Oliveira Couto wrote:

> 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
> 
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list