View Full Version : Need to create program with checkboxes to run other programs

December 1st, 2009, 10:52 PM
I am doing a project for my operating systems class where I created several different SH files to run. I want to be able to make a graphical program where you can check which SH files to run, click ok, and then they run. Can anyone point me in the direction of how to do this? I don't have much graphical programming experience, but I should be able to figure it out, though I'd like something a little on the easier side if possible. Thanks!

December 2nd, 2009, 12:07 AM
If you only want to choose the script(s) from a list and run it/them, and nothing fancier than that, you don't even need to leave the shell.

* Collect the scripts you want to run in some manner, file, array etc.
* Display that collection graphically with zenity.
* Use the returned (selected) value to run the script(s).
* If several values are returned, you need to split the returned ones and run them in a loop.

$ zenity --help
$ output=$(ls -l) # Saves the output from ls -l in variable output
$ input="comma,separated,list,of,values"
$ IFS=","; for word in $input; do echo $word; done # Prints the words on a line each

If you are into something more fancy then this tutorial on glade with c or python is very helpfull for getting started with GUIs.


December 2nd, 2009, 01:16 AM
grab 1 of my scripts here:

and just tweak it.


read=`zenity --height=250 --list --title='A+ Please!' --column=Action command-1 command-2`

if [ $read = "command-1" ]; then

if [ $read = "command-2" ]; then

December 2nd, 2009, 04:02 AM
Thanks! That works great, except I have one problem:

read=`zenity --height=250 --list --checklist --title='Selection' --column=Boxes --column=Selections TRUE a TRUE b TRUE c --separator=':'`

if [ ???? ]; then
do something

if [ ???? ]; then
do other thing

if [ ???? ]; then
do other thing

If the user checks a and c, it will return "a:c". So I need a way to say "if $read contains a, then do this," or some other way accomplish the same thing.