xmessage or lua fltk


Forum: Programming and Scripting
Topic: xmessage or lua fltk
started by: mikshaw

Posted by mikshaw on April 29 2006,02:51
Just messing around with some stuff, and i noticed that lua-fltk will read stdin as a file.  I'm sure there are piles of uses for this, but the first one that came to mind is that flua can emulate xmessage from a shell script or xterm.  I know Robert has made a popup script for this purpose (or something very similar) already, and now i'm starting to wonder if xmessage might be easily replaced by a few lines of code.
Code Sample
echo "fl_message(\"some text\")"|flua

Code Sample
echo -e "fl_message(\"some text\")\nfl_message(\"some more text\")"|flua

This might be expanded to use a browser for displaying a text file, and accept xmessage parameters...it seems as though a tiny script could fully and seemlessly replace xmessage.  The thing i'm not sure of is how the exit codes could be implemented.

Posted by Glacial on May 04 2006,16:52
echo 'fl_message("Some Text 2")'|flua

Works with out the back slashes.

However fl_alert does not?  The lua FTLK manual has like 3 lines that says these FTLK standard dialogs are there but I've been having trouble finding examples or documentation for them.  I've found doc for them at the FLTK site but it's of no help.  fl_alert( char *, ...)    All of the fl_dialogs show the ", ...)" which is??

Posted by dare2dreamer on May 04 2006,19:57
Ok, you get beer money when you fully replicate zenity in flua. :-)
Posted by Glacial on May 04 2006,23:04
zenity exists on my CD?
Posted by mikshaw on May 05 2006,04:05
Quote (Glacial @ May 04 2006,12:52)
However fl_alert does not?  The lua FTLK manual has like 3 lines that says these FTLK standard dialogs are there but I've been having trouble finding examples or documentation for them.  I've found doc for them at the FLTK site but it's of no help.  fl_alert( char *, ...)    All of the fl_dialogs show the ", ...)" which is??

I noticed that too.  According to the docs, lua-fltk was a 1-weekend project, so my guess is that Mr. Carlson did what he felt like doing at the moment and never really finished it.  There are actually several standard fltk widgets that have little or no functionality in lua fltk.
Posted by Glacial on May 05 2006,17:27
Cool, at least I know I'm not doing something wrong with fl_alert then.
I've used fl_message, fl_ask, and fl_input without any troubles so far.


A what to feed back to the calling script:

echo -e "z=fl_ask('What')\nif(z)then exit(1)else exit(2)end"|flua

Posted by mikshaw on May 05 2006,17:57
Yay! =o)
I dunno why i didn't think about passing the exit status that way...it's basically the same as in bash...

Maybe i'll see about making a fltk xmessage now, just for gits and shiggles.

Powered by Ikonboard 3.1.2a
Ikonboard © 2001 Jarvis Entertainment Group, Inc.