Making radio buttons work with Zenity
I have a Zenity script that shows an acceptable use policy for a school I work at which looks like this
Code:
zenity --title "Acceptable Use Policy" --text "All users of this machine must acknowledge and abide by \n all rules and regulations set by the acceptable use policy \n of the schools. This policy can be viewed on the front \n of the door of this computer lab" --list --radiolist --column "Choice" --column "Answer" True Accept False Deny |
You need to look at the syntax for what Zenity returns for different options. There are a minimum of two things: The returned value, and the exit status.
I have a simple script that uses the --entry option. The value returned is the string entered in the box. The exit status is determined by whether the user clicks "OK" or "cancel". I assume the behavior is similar when using radio buttons. To look at exit status, look at "$?" This is the bash variable which contains the exit status of the last command executed. |
So for example, if hitting the "accept" button returns an exit status of 0, I could use the 0 later in the script like in an if statement?
|
Quote:
|
Ok, that makes sense. Thanks.
|
I just stumbled across this thread while trying to accomplish a similar task. Zenity has a text "information dialog box" option. You can store the message for your users in a separate file and give them the option of either checking the box and confirming or aborting. It seems that would be the better choice in this situation.
|
|
All times are GMT -5. The time now is 04:15 PM. |