Running an LC app from the command line

Ben Rubinstein benr_mc at cogapp.com
Tue Jun 10 15:32:09 EDT 2014


On 05/06/2014 17:46, Mark Talluto wrote:
> On Jun 5, 2014, at 9:26 AM, Peter Haworth <pete at lcsql.com> wrote:
>
>> Thanks everyone.  SOunds like hiding and positioning off screen is the way
>> to go, particularly since I need this to work on Windows as well as Mac and
>> I think -ui is Mac only (and possibly Linux?)
>
> You can always just set the vis of the stack to false and leave it where you like.

FWIW, I have an app which runs fine as standalone or CLI, on Mac Windows and 
Linux.  Originally developed for the former, it took quite a bit of work to 
get it stable CLI.

When it starts up, it hides the main stack if it's in CLI mode; and also needs 
to check in various places if it is in CLI mode to avoid performing other 
graphic operations, which would indeed lead to an early and immediate exit. 
Also - it may be obvious! - to ensure that when unusual things happen which 
would normally throw up a dialog box, they instead write something to the console.

The code to check if it's in CLI mode used to just check "the environment" - 
but a note in my code records that this ceased to return the correct value 
sometime between version 3.5 and 4.6 (I haven't checked if it's been fixed 
since).  It now checks the environment (= "command line"?), the windowID of 
the main stack (= 1?) and finally $1 ( = "headless" ?) and if any of those are 
true considers that it must be in CLI mode.  It's so long ago that I don't 
recall, but I assume that the last of these tests was a desperation move 
allowing me to force it into that mode.

Ben




More information about the use-livecode mailing list