Trying for script to execute Xdialog options (Solved).
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, 21:21, edited 1 time in total.
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]
[url=http://www.murga-linux.com/puppy/viewtopic.php?t=72178][b][i]Puppy Crypt 528[/i][/b][/url]
- Moose On The Loose
- Posts: 965
- Joined: Thu 24 Feb 2011, 14:54
Re: Need help with script to execute Xdialog (Combobox) options.
Are you having trouble with the detecting which was clicked or the running the commands?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.
Re: Need help with script to execute Xdialog (Combobox) options.
I'm not sure, perhaps both.Moose On The Loose wrote:Are you having trouble with the detecting which was clicked or the running the commands?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.
Is this what you want?
If EAT, KICK and CATCH are real commands change echo to exec.
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.