Distinguishing CLI from GUI

Andre Garzia andre at andregarzia.com
Thu Jun 16 10:15:23 EDT 2011

On Thu, Jun 16, 2011 at 11:04 AM, Richard Gaskin <ambassador at fourthworld.com
> wrote:

> Warren Samples wrote:
>  Just to point out, although I'm sure you noticed;  while I do get the
>> promised $ vars, which appears to be not
>> working for you, the "-ui" flag is not being stored here, and it seems
>> you're interested in getting that. That
>> the $ values exist at all would indicate commandline, but it's not
>> inconceivable that one might want some
>> conditional behaviors based on whether or not the app is running with a
>> gui, thus storing the "-ui" flag could
>> be helpful. Such refinement is naturally only useful if the basics can be
>> relied on, though :(
> Actually, the $ vars will contain the paths to any files the app is
> launched with in the GUI too, which is why relying on the presence of the $
> vars alone won't work for me since our apps read those values to determine
> which files to open at launch.
> Thanks for confirming what Mark Weider discovered, that flags used by the
> engine ("-ui" is among the very few that are still used) aren't passed along
> to the app.  It seems other args not used by the engine are passed along,
> however, so we can design our own syntax as needed - quite exciting, in a
> geeky sorta way. :)
> For now it seems I can use the window ID to figure out whether the app is
> launched with -ui; in my testing on all three platforms the window ID of the
> mainstack is 1 when launched with -ui, but not when launched with the GUI.
> Extra bonus points:
> When using R, MySQL, Mongo, and many other apps, I'm in an interactive mode
> in which the app provides its own console UI and its own prompt.
> It may be useful down the road to be able to provide such an interactive
> mode for the command line, but I've been unable to wrap my head around using
> stdin and stdout to do this.  So far, I can only pass args to the app, have
> it process those, and deliver output from them and quit.
> How can I set up my own interactive mode from the command line, and can I
> make a custom prompt to signify to the user that they're in my app?
if you do put in a standalone, it will echo its message to the stdout, so
that gives you output. You can try reading from stdin to see if you can get
keyboard input, never tried though.

> --
>  Richard Gaskin
>  Fourth World
>  LiveCode training and consulting: http://www.fourthworld.com
>  Webzine for LiveCode developers: http://www.LiveCodeJournal.com
>  LiveCode Journal blog: http://LiveCodejournal.com/blog.irv
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

http://www.andregarzia.com All We Do Is Code.

More information about the Use-livecode mailing list