Command-Line Only Standalone?

Are you using LiveCode to create server scripts or CGIs?

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Command-Line Only Standalone?

Post by icouto » Mon Apr 28, 2014 6:52 am

Is it possible to create a command-line only standalone binary with LiveCode, or does the created app either have to be a GUI app, or a script that is parsed by livecode-server? Is it possible to create a faceless daemon, or a command-line tool?

BvG
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1236
Joined: Sat Apr 08, 2006 1:10 pm
Location: Zurich
Contact:

Re: Command-Line Only Standalone?

Post by BvG » Mon Apr 28, 2014 1:21 pm

yes. you want the -ui parameter.
Various teststacks and stuff:
http://bjoernke.com

Chat with other RunRev developers:
chat.freenode.net:6666 #livecode

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Command-Line Only Standalone?

Post by icouto » Tue Apr 29, 2014 2:10 am

Are you compiling the binary from the command line? How do you do that?! If not, where do you enter this parameter?

Your guidance is truly appreciated.

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8424
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Command-Line Only Standalone?

Post by FourthWorld » Tue Apr 29, 2014 2:49 am

Any standalone made with LiveCode can be written to work well when run from the command line. The -ui is passed to the app with the app name in the command line, e.g.:

./myAppName -ui

When run from the command line, the app will get a startup message - put your code in a startup handler and you're off and running.
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

icouto
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 92
Joined: Wed May 29, 2013 1:54 am
Location: Sydney, Australia

Re: Command-Line Only Standalone?

Post by icouto » Tue Apr 29, 2014 7:33 am

Many thanks!

trags3
Posts: 363
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Command-Line Only Standalone?

Post by trags3 » Tue Jul 01, 2014 2:04 am

FourthWorld wrote:Any standalone made with LiveCode can be written to work well when run from the command line. The -ui is passed to the app with the app name in the command line, e.g.:

./myAppName -ui

When run from the command line, the app will get a startup message - put your code in a startup handler and you're off and running.
Hi FourthWorld
So I can build an app for linux on my macbook, post it to the server, I assume LC Server must be resident on the server and run it with the command you gave above?
Is there more to the command?
Specifically what kind code would be in the startup handler?
do you have a short example you could show?
I'm pretty new to LC and very very new to server stuff.
Thanks Tom

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 8424
Joined: Sat Apr 08, 2006 7:05 am
Location: Los Angeles
Contact:

Re: Command-Line Only Standalone?

Post by FourthWorld » Tue Jul 01, 2014 2:40 am

trags3 wrote:
FourthWorld wrote:Any standalone made with LiveCode can be written to work well when run from the command line. The -ui is passed to the app with the app name in the command line, e.g.:

./myAppName -ui

When run from the command line, the app will get a startup message - put your code in a startup handler and you're off and running.
Hi FourthWorld
Feel free to call me Richard.
So I can build an app for linux on my macbook, post it to the server, I assume LC Server must be resident on the server and run it with the command you gave above?
What's needed to simply run an app from the command line is slightly different from what's needed to run an app under a Web server.

Any app on a server, whether you're using LiveCode Server or have special requirements best met from a custom standalone, needs to integrate with the Web server application. Most commonly the Web server is Apache, and the common interface between them is CGI, which is a simple convention for adding specialized apps on the server in a way Apache can work with them. On most shared hosts this is done through mod_rewrite rules written in a .htaccess file in the server's Web root. Sounds like a lot of steps, and indeed Apache is a deep and very flexible toolkit, but most of the small bits you need to get started are covered in the LiveCode Server Guide:
http://livecode.com/developers/guides/server/

Until you've had enough experience with LiveCode Server to know why you might want to make a custom standalone instead, you'll find more code examples and generally better support from the community by just using LiveCode Server, which is set up to work well with Apache.
Richard Gaskin
LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

trags3
Posts: 363
Joined: Wed Apr 09, 2014 1:58 am
Location: Las Vegas, NV

Re: Command-Line Only Standalone?

Post by trags3 » Tue Jul 01, 2014 4:30 am

Richard, thanks so much for the clarification.
I have a very simple task that I want to do on a server. I have developed a fairly simple mobile app that takes data input by the user and does some simple processing of it, shows the results and then allows the user to email the results to their clients.
Any time this is done my client wants to be assured that he is informed that the app was used, & who used it.
Because of the way LC interfaces with the email client I can't rely on the user to not delete the email address of my client so I want to have the app communicate with a server some of the pertinent information and relay that to my client. None of this would require any action from the user of the app and they would have no human communication with the server.
Other tasks will be user registration and login but the login will just pass a message to the app that it is ok to proceed. The basic purpose of this is the app needs to run differently in different parts of the country and the customer contact depends on where it is being used.
I think I can do everything I need to do on the server in 2 or 3 cards and 2 or three MySQL tables.
What I have not quite figured out yet is how I can run a small stack with LC Server to do the data collect and re transmit function.
but I ramble on....
These forums have been very helpful but i'm not quite there.

Thanks again,

Tom

Post Reply

Return to “CGIs and the Server”