Trying for script to execute Xdialog options (Solved).

For discussions about programming, programming questions/advice, and projects that don't really have anything to do with Puppy.
Post Reply
Message
Author
User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

Trying for script to execute Xdialog options (Solved).

#1 Post by nic007 »

I want to use xdialog's combobox. Basically it creates a menu list where one can highlight an item and then select OK to run a specific command (there is also a Cancel button). I can create the combobox but need help with the script to run the commands. Let's say the three items in the menu are JOHN PETE KURT. If I select JOHN from menu and click OK, I want to run the command EAT. If selection is PETE then command KICK. If selection KURT then command CATCH. Thanks.
Last edited by nic007 on Fri 09 Jun 2017, 21:21, edited 1 time in total.

DPUP5520
Posts: 800
Joined: Wed 16 Feb 2011, 05:38

#2 Post by DPUP5520 »

hey nic007 take a look at this topic here maybe it can help you solve the issues you're having http://murga-linux.com/puppy/viewtopic.php?t=109790
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=69651][b][i]PupRescue 2.5[/i][/b][/url]
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=72178][b][i]Puppy Crypt 528[/i][/b][/url]

User avatar
Moose On The Loose
Posts: 965
Joined: Thu 24 Feb 2011, 14:54

Re: Need help with script to execute Xdialog (Combobox) options.

#3 Post by Moose On The Loose »

nic007 wrote:I want to use xdialog's combobox. Basically it creates a menu list where one can highlight an item and then select OK to run a specific command (there is also a Cancel button). I can create the combobox but need help with the script to run the commands. Let's say the three items in the menu are JOHN PETE KURT. If I select JOHN from menu and click OK, I want to run the command EAT. If selection is PETE then command KICK. If selection KURT then command CATCH. Thanks.
Are you having trouble with the detecting which was clicked or the running the commands?

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

Re: Need help with script to execute Xdialog (Combobox) options.

#4 Post by nic007 »

Moose On The Loose wrote:
nic007 wrote:I want to use xdialog's combobox. Basically it creates a menu list where one can highlight an item and then select OK to run a specific command (there is also a Cancel button). I can create the combobox but need help with the script to run the commands. Let's say the three items in the menu are JOHN PETE KURT. If I select JOHN from menu and click OK, I want to run the command EAT. If selection is PETE then command KICK. If selection KURT then command CATCH. Thanks.
Are you having trouble with the detecting which was clicked or the running the commands?
I'm not sure, perhaps both.

User avatar
smokey01
Posts: 2813
Joined: Sat 30 Dec 2006, 23:15
Location: South Australia :-(
Contact:

#5 Post by smokey01 »

Is this what you want?

Code: Select all

#!/bin/sh
answer=`Xdialog --stdout --title "Title" --combobox "text" 0 0 "JOHN" "PETE" "KURT"`
case "$answer" in
        JOHN)
        echo EAT 
        ;;
        PETE)
        echo KICK 
        ;;
        KURT)
        echo CATCH 
        ;; 
 esac

If EAT, KICK and CATCH are real commands change echo to exec.

User avatar
nic007
Posts: 3408
Joined: Sun 13 Nov 2011, 12:31
Location: Cradle of Humankind

#6 Post by nic007 »

Thank you, smokey01

Post Reply