Page 1 of 1

how to get scripts working

Posted: Thu Mar 06, 2014 12:12 pm
by planix
Hi,

I have set up a server on my Windows PC (XAMMP) to try and get my head around using livecode-server.

I am using LCS 6.1

I decided to use .htaccess in the first instance as I am planning to move to an external solution once I have a better understanding of how this all works.

I have put the LCS in the cgi-bin folder. I have set up a folder called livecode-server and put the exe and dll folders into that. I have an .htaccess file in the cgi-bin outside of the livecode-server folder.

-cgi-bin
--.htaccess
--<livecode-server>
---<drivers>
---<externals>
----livecode-server.exe

Now, this seems to work. I put the test.lc script suggested in the livecode tutorials into htdocs(which is equivalent to public-html on XAMMP).

The file with the script reads:
<html>
<head>
<title>My LiveCode Server Test Page</title>
</head>
<body>
<h1>My LiveCode Server Test Page</h1>
<?lc
put "<p>Hello World! from LiveCode Server</p>"
put "<p>The date is " && the date & "</p>"
?>
</body>
</html>
The first part of the script stuff works. But the second put statement doesn't seem to be processed.

I get a page that reads
My LiveCode Server Test Page

Hello World! from LiveCode Server
" put "
The date is " && the date & "

" ?>
Does anyone have some clues as to what might be going wrong here?

cheers

Re: how to get scripts working

Posted: Thu Mar 06, 2014 8:24 pm
by BvG
LC depends on proper returns at the end of lines. It's possible that the engine on windows expects script files to use crlf, and the example file is probably made for unix/linux.

You can use the LC ide to convert the file into crlf, but make sure you do this with a copy, so you can try other solutions if crlf is actually not the problem.

Code: Select all

--untested
on mouseUp
answer file ""
put url ("binfile:" & it) into theData
if not theData contains crlf then
put url ("file:" & it) into theData --creates file with crlf when run on windows system
end if
end moseup

Re: how to get scripts working

Posted: Thu Mar 06, 2014 10:13 pm
by planix
Thanks. I tried this and the output was the same. Though it does look like something of that kind is happening doesn't it.

cheers