Author |
Message |
nic007

Joined: 13 Nov 2011 Posts: 2323 Location: Cradle of Humankind
|
Posted: Fri 09 Jun 2017, 08:27 Post subject:
Trying for script to execute Xdialog options (Solved). |
|
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, 17:21; edited 1 time in total
|
Back to top
|
|
 |
DPUP5520
Joined: 16 Feb 2011 Posts: 813
|
Posted: Fri 09 Jun 2017, 09:44 Post subject:
|
|
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
_________________ PupRescue 2.5
Puppy Crypt 528
|
Back to top
|
|
 |
Moose On The Loose

Joined: 24 Feb 2011 Posts: 778
|
Posted: Fri 09 Jun 2017, 10:24 Post subject:
Re: Need help with script to execute Xdialog (Combobox) options. |
|
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?
|
Back to top
|
|
 |
nic007

Joined: 13 Nov 2011 Posts: 2323 Location: Cradle of Humankind
|
Posted: Fri 09 Jun 2017, 10:53 Post subject:
Re: Need help with script to execute Xdialog (Combobox) options. |
|
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.
|
Back to top
|
|
 |
smokey01

Joined: 30 Dec 2006 Posts: 2682 Location: South Australia
|
Posted: Fri 09 Jun 2017, 11:08 Post subject:
|
|
Is this what you want?
Code: | #!/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.
_________________ Software <-> Distros <-> Tips <-> Newsletters
|
Back to top
|
|
 |
nic007

Joined: 13 Nov 2011 Posts: 2323 Location: Cradle of Humankind
|
Posted: Fri 09 Jun 2017, 17:19 Post subject:
|
|
Thank you, smokey01
|
Back to top
|
|
 |
|