Page 1 of 1

run application in background without a gui

Posted: Wed Oct 19, 2011 8:21 am
by harald.schlager
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

Re: run application in background without a gui

Posted: Wed Oct 19, 2011 1:49 pm
by BvG
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).

Re: run application in background without a gui

Posted: Wed Oct 19, 2011 2:24 pm
by FourthWorld
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.

Re: run application in background without a gui

Posted: Wed Oct 19, 2011 6:05 pm
by mwieder
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.

Re: run application in background without a gui

Posted: Thu Oct 20, 2011 6:43 am
by harald.schlager
thank you for the fast answer, both works :D