Can we create a Windows service with Livecode?
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Can we create a Windows service with Livecode?
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
Can this be done on Windows? Mac? Linux?
Thanks.
Mike
-
- VIP Livecode Opensource Backer
- Posts: 9680
- Joined: Wed May 06, 2009 2:28 pm
- Location: New York, NY
Re: Can we create a Windows service with Livecode?
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
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
-
- Livecode Opensource Backer
- Posts: 366
- Joined: Tue Apr 10, 2012 9:18 am
Re: Can we create a Windows service with Livecode?
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.
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.
-
- Posts: 722
- Joined: Thu Sep 11, 2014 1:49 pm
- Location: The Netherlands
Re: Can we create a Windows service with Livecode?
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
https://www.howtogeek.com/50786/using-s ... s-service/
https://robotronic.de/runasserviceen.html
Regards,
Paul
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Can we create a Windows service with Livecode?
Those links are perfect. Thank you.mrcoollion wrote: ↑Wed Aug 12, 2020 5:30 pmHere are some links that might offer a solution.
https://www.howtogeek.com/50786/using-s ... s-service/
https://robotronic.de/runasserviceen.html
Regards,
Paul
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
-
- VIP Livecode Opensource Backer
- Posts: 9846
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Can we create a Windows service with Livecode?
The environment function will return "development" when in the IDE, e.g.:karmacomposer wrote: ↑Wed Aug 12, 2020 6:15 pmHow do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
Code: Select all
on openStack
if "dev" is in the environment then exit openStack
DoSomethingAtRuntime
end openStack
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Can we create a Windows service with Livecode?
So it quits openStack which then allows me to compile, correct?FourthWorld wrote: ↑Wed Aug 12, 2020 9:24 pmThe environment function will return "development" when in the IDE, e.g.:karmacomposer wrote: ↑Wed Aug 12, 2020 6:15 pmHow do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?Code: Select all
on openStack if "dev" is in the environment then exit openStack DoSomethingAtRuntime end openStack
The DoSomethingAtRuntime is the rest of the routine, correct?
Thank you.
Mike
-
- VIP Livecode Opensource Backer
- Posts: 9846
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Can we create a Windows service with Livecode?
Yes, and yes. It does what it appears to do.
When in doubt try it and see what happens...
When in doubt try it and see what happens...
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
Re: Can we create a Windows service with Livecode?
You could also first turn Messages Off in the IDE, and the load it. Nothing will work from your stack then.karmacomposer wrote: ↑Wed Aug 12, 2020 6:15 pmHow do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
You can build an exe.
-
- Posts: 361
- Joined: Wed Apr 27, 2011 2:12 pm
Re: Can we create a Windows service with Livecode?
That does not work when the main functions are both in openStack and opencard.sphere wrote: ↑Fri Aug 14, 2020 10:14 amYou could also first turn Messages Off in the IDE, and the load it. Nothing will work from your stack then.karmacomposer wrote: ↑Wed Aug 12, 2020 6:15 pmHow do I start Livecode so that a openStack (or openCard) command does not execute immediately and allows me to compile?
You can build an exe.
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
Re: Can we create a Windows service with Livecode?
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.
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.
-
- VIP Livecode Opensource Backer
- Posts: 9846
- Joined: Sat Apr 08, 2006 7:05 am
- Location: Los Angeles
- Contact:
Re: Can we create a Windows service with Livecode?
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.karmacomposer wrote: ↑Fri Aug 14, 2020 2:00 pmFourthworld's advice, with some tweaking, worked for me. I had to use the long word "development" and specify "standalone application" as well.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn