run application in background without a gui

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: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
harald.schlager
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 16
Joined: Mon May 09, 2011 3:01 pm

run application in background without a gui

Post by harald.schlager » Wed Oct 19, 2011 8:21 am

hi all !

i want to write a small set of utilities that should run in the background without a gui like
classic console applications in windows.

is there a possibility to do that with livecode.

thank you in advance,
harald

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

Re: run application in background without a gui

Post by BvG » Wed Oct 19, 2011 1:49 pm

I think you can do that using the "-ui" command line parameter. Another approach is to hide the ui stack immediately when the app starts. On windows an app without windows does not show up in the start bar, but I am not sure if it's possible to hide the app icon from the dock on mac os ox (maybe there's some way using shell scripting, or maybe something in the plist files).
Various teststacks and stuff:
http://bjoernke.com

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

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10044
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: run application in background without a gui

Post by FourthWorld » Wed Oct 19, 2011 2:24 pm

Yes, very doable. I've recently been adding CLI support to some of my apps for admins who need to execute them across their network, and it works great.

Like BVG said, passing "-ui"as an argument to the standalone will cause it to run without a GUI, and you can get the other arguments passed to it by checking the environment variables "$0", "$1", "$2", etc. You can find the number of arguments passed with "$#".

CLI in LC is easy and fun. Feel free to post back here if you run into any snags, as I'm sure we can help you find solutions for just about anything you'd encounter with this.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

mwieder
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 3581
Joined: Mon Jan 22, 2007 7:36 am
Contact:

Re: run application in background without a gui

Post by mwieder » Wed Oct 19, 2011 6:05 pm

As an alternative, I don't even bother with the "-ui" commandline argument for standalones, I just use

Code: Select all

on startup
  hide this stack
end startup
Note: the startup handler will only be called from a standalone application environment and won't affect your development work.

harald.schlager
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 16
Joined: Mon May 09, 2011 3:01 pm

Re: run application in background without a gui

Post by harald.schlager » Thu Oct 20, 2011 6:43 am

thank you for the fast answer, both works :D

Post Reply