Can we create a Windows service with Livecode?

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
karmacomposer
Posts: 355
Joined: Wed Apr 27, 2011 2:12 pm

Can we create a Windows service with Livecode?

Post by karmacomposer » Wed Aug 12, 2020 3:51 pm

I would like to convert one of my desktop apps made with Livecode into a running service so it can run seamlessly in the background and not be easily shut down to ward against hackers and breaches.

Can this be done on Windows? Mac? Linux?

Thanks.

Mike

dunbarx
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 7321
Joined: Wed May 06, 2009 2:28 pm
Location: New York, NY

Re: Can we create a Windows service with Livecode?

Post by dunbarx » Wed Aug 12, 2020 4:45 pm

Hi.

I am not sure what you are asking for, but a running standalone will, er, run in the background all by its lonesome.

I made a test stack long ago, and just found it again. All it does is start a counter that increments a field a few times per second. The process can only be stopped if you press the optionKey. If I start it running, and then go to any other app, like the Finder, Excel or Safari, it increments. If, still in one of those other apps, I press the optionKey, it stops.

Craig

ghettocottage
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 362
Joined: Tue Apr 10, 2012 9:18 am

Re: Can we create a Windows service with Livecode?

Post by ghettocottage » Wed Aug 12, 2020 5:09 pm

Running an application as a service (or daemon in linux) has some advantages, for example:
It is running for all users rather than just the user you are logged in as when you manually start an application
It can auto-start at boot rather than having to have a particular user logged in (preferable for headless servers and such)

My linux desktop acts as a server in my house and I have quite a few applications running as a daemon. Plenty of online tutorials how to set up with system.d or init (for older versions).

In Windows I am not sure, but 4 years ago I set up a simple batch script as a service and do not remember it being too difficult. I had to use the Windows Scheduler to set it up.

mrcoollion
Posts: 597
Joined: Thu Sep 11, 2014 1:49 pm
Location: The Netherlands

Re: Can we create a Windows service with Livecode?

Post by mrcoollion » Wed Aug 12, 2020 5:30 pm

Here are some links that might offer a solution.

https://www.howtogeek.com/50786/using-s ... s-service/

https://robotronic.de/runasserviceen.html

Regards,

Paul

karmacomposer
Posts: 355
Joined: Wed Apr 27, 2011 2:12 pm

Re: Can we create a Windows service with Livecode?

Post by karmacomposer » Wed Aug 12, 2020 6:15 pm

mrcoollion wrote:
Wed Aug 12, 2020 5:30 pm
Here are some links that might offer a solution.

https://www.howtogeek.com/50786/using-s ... s-service/

https://robotronic.de/runasserviceen.html

Regards,

Paul
Those links are perfect. Thank you.

Second question:

I would prefer to run the program's contents inside a openStack command but if I do, it makes compiling impossible because it starts up right away and locks me out.

The app is copying files from one location to another using TsNet.

How do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?

Thanks.

Mike

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

Re: Can we create a Windows service with Livecode?

Post by FourthWorld » Wed Aug 12, 2020 9:24 pm

karmacomposer wrote:
Wed Aug 12, 2020 6:15 pm
How do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
The environment function will return "development" when in the IDE, e.g.:

Code: Select all

on openStack
   if "dev" is in the environment then exit openStack
   DoSomethingAtRuntime
end openStack
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

karmacomposer
Posts: 355
Joined: Wed Apr 27, 2011 2:12 pm

Re: Can we create a Windows service with Livecode?

Post by karmacomposer » Wed Aug 12, 2020 11:49 pm

FourthWorld wrote:
Wed Aug 12, 2020 9:24 pm
karmacomposer wrote:
Wed Aug 12, 2020 6:15 pm
How do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
The environment function will return "development" when in the IDE, e.g.:

Code: Select all

on openStack
   if "dev" is in the environment then exit openStack
   DoSomethingAtRuntime
end openStack
So it quits openStack which then allows me to compile, correct?

The DoSomethingAtRuntime is the rest of the routine, correct?

Thank you.

Mike

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

Re: Can we create a Windows service with Livecode?

Post by FourthWorld » Thu Aug 13, 2020 4:21 am

Yes, and yes. It does what it appears to do.

When in doubt try it and see what happens...
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

sphere
Posts: 1109
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Can we create a Windows service with Livecode?

Post by sphere » Fri Aug 14, 2020 10:14 am

karmacomposer wrote:
Wed Aug 12, 2020 6:15 pm
How do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
You could also first turn Messages Off in the IDE, and the load it. Nothing will work from your stack then.
You can build an exe.

karmacomposer
Posts: 355
Joined: Wed Apr 27, 2011 2:12 pm

Re: Can we create a Windows service with Livecode?

Post by karmacomposer » Fri Aug 14, 2020 2:00 pm

sphere wrote:
Fri Aug 14, 2020 10:14 am
karmacomposer wrote:
Wed Aug 12, 2020 6:15 pm
How do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
You could also first turn Messages Off in the IDE, and the load it. Nothing will work from your stack then.
You can build an exe.
That does not work when the main functions are both in openStack and opencard.

On or off does not seem to matter, unless messages are somewhere else entirely. Where do you turn messages on or off? If it's the same as running your app or not, does not matter.

Fourthworld's advice, with some tweaking, worked for me. I had to use the long word "development" and specify "standalone application" as well.

Mike

sphere
Posts: 1109
Joined: Sat Sep 27, 2014 10:32 am
Location: Earth, Except when i Jump

Re: Can we create a Windows service with Livecode?

Post by sphere » Fri Aug 14, 2020 6:57 pm

Close and remove all stacks from memory.
There is a big button in the upper bar of the ide, messages. When it's turned off and then you load your stack. Nothing of the stack will work. Untill you turn it on again.
At least on all lc ide's i had installed here, it worked that way.

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

Re: Can we create a Windows service with Livecode?

Post by FourthWorld » Fri Aug 14, 2020 7:39 pm

karmacomposer wrote:
Fri Aug 14, 2020 2:00 pm
Fourthworld's advice, with some tweaking, worked for me. I had to use the long word "development" and specify "standalone application" as well.
The "is in" operator works on substrings, so as written the long form of "development" would not be needed. It would be needed if you replaced "is in" with "is", but as written it works; I use it daily here.
Richard Gaskin
Community volunteer LiveCode Community Liaison

LiveCode development, training, and consulting services: Fourth World Systems: http://FourthWorld.com
LiveCode User Group on Facebook : http://FaceBook.com/groups/LiveCodeUsers/

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”