Re: converting bash-scripts into GUI's



At Mon, 07 Jul 2008 16:16:26 -0500 Roland Latour <bogus@xxxxxxxxx> wrote:


On Mon, 07 Jul 2008 19:52:13 +0000, Rahul wrote:

Robert Heller <heller@xxxxxxxxxxxx> wrote in
news:06qdnXaoiqZ6tO_VnZ2dnUVZ_vSdnZ2d@xxxxxxxxxxxxxxx:


I believe the OP wants to take a bash or perl script, that has various
parameters and/or options and create a GUI front end, where it pops up
a window with various entries, check buttons, option buttons/menus,
etc. that deal with the parameters and options. This is pretty much a
non-trivial task and I don't believe there are any automated programs
for doing this.

That's exactly what I wanted to do Robert.

Why not use 'dialog' or 'xmessage' in your shell script?

dialog is limited to shell windows (it is not a 'true' GUI in a sense).

xmessage can only display a message and a batch of buttons. It has no
provision for things like:

entries (for entering random short strings)
option menus (for a selection of choices)
file browsers (for selecting a file)
check buttons (for selecting (or not) optional values)
radio buttons (for selecting one of several choices)

etc.

Say you have a shell script, replacestr.sh, that takes a two file names
(one input and one output) that edits the file, replacing the first (or
last) N (all by default) occurences of some string X replacing it with
string Y. The script takes four fixed parameters and two options:

../replacestr.sh [-count N] [-from start/end] infile outfile string1 string2

A GUI for this would have:

two file browsers, one that checks for an existing file and one that
checks for a possible overwrite of an existing file.

two entries, one for string1 and one for string2

It would have two check boxes: [] first N strings [] last N strings

and a checkbox/entry combo: for all? and for the count (with checking
for a positive non-zero integer)

You could probably do this with dialog (might take 2-3 screens), I don't
think xmessage can do this.

This is all easy enough to do with Tcl/Tk (esp. with BWidget and SNIT)
and can be done with Perl/Tk or Python/Tk or one can re-write one's
10-line shell script with 500+ lines of C or C++ using Gtk or Qt...



--
Robert Heller -- Get the Deepwoods Software FireFox Toolbar!
Deepwoods Software -- Linux Installation and Administration
http://www.deepsoft.com/ -- Web Hosting, with CGI and Database
heller@xxxxxxxxxxxx -- Contract Programming: C/C++, Tcl/Tk

.