Page 1 of 1

New to HTML

Posted: Tue Feb 27, 2024 9:08 pm
by kaveh1000
Hi all

Sorry for my long absence!!

I have a stack that I have worked on for years. I now need to run it as a web service rather than a desktop app. Is this now an option?

the stack manipulates text using lots of LiveCode and regex. So I need a text file to be sent to it and it will send back a text file.

Thanks.

Regards
Kaveh

Re: New to HTML

Posted: Wed Feb 28, 2024 12:01 pm
by richmond62
I maybe very stupid, but what is the connexion between the thread title "New to HTML" and "So I need a text file to be sent to it and it will send back a text file."?

I don't think 'anything' is going to SEND a text file to a Livecode stack/standalone: the Livecode stack/standalone is going to have to FIND a text file and then import it.

Possibly a bit like this:

Code: Select all

on mouseUp
   answer file "Choose a TEXT file to import"
   if the result = "cancel" 
   then exit mouseUp
   else
      set the TEXT of fld "fRESULT" to URL ("file:" & it)
   end if
end mouseUp
and then, having processed it, the Livecode stack/standalone can export the contents of a field into a new text file.

Re: New to HTML

Posted: Wed Feb 28, 2024 1:41 pm
by kaveh1000
Hi Richmond

Great to be in touch again. Got so much help from you in the past!! I think I did not explain properly...

I have a stack where I can drop in a text file and it cleans it up for me using the handlers I have written in LiveCode. But I am the only person using LiveCode in my team. Everything else we have is web based like the rest of the universe. So in our web based application there is a text field that would normally be cleaned up in say JavaScript.

I want my code to be used as a web service. so you press a button on the web page, the text is sent to my stack and the stack sends back the clean text file.

I know there is a HTML project for LiveCode so stacks are online. I just want to know if that is now possible. Hope that is clearer...

Regards
Kaveh

Re: New to HTML

Posted: Wed Feb 28, 2024 2:03 pm
by Klaus
Hi Kaveh,

since html5 does not support the clipboard or copy/paste, here a workaround for this problem:
https://forums.livecode.com/viewtopic.p ... 15#p227904
No idea if html5 can import/export text files...

Best

Klaus

Re: New to HTML

Posted: Wed Feb 28, 2024 5:36 pm
by SWEdeAndy
Klaus wrote:
Wed Feb 28, 2024 2:03 pm
No idea if html5 can import/export text files...
It can.
But I think the main issue here is to get the web deployment to act as a behind-the-scenes web service, that can be invoked without a user interface. I don’t think that is possible, as the stack and the LC engine can only function when loaded in an active web page.

A trick might be to embed the web deployment into the web page that is requesting its services, and call it from there. But it seems a bit of a cumbersome solution…