LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Zenity script help (https://www.linuxquestions.org/questions/linux-newbie-8/zenity-script-help-4175594328/)

zvlo 11-27-2016 01:16 PM

Zenity script help
 
Hello I am trying to make a zenity program that has to answer these questions.
http://i67.tinypic.com/2qwmvx5.jpg

Here is the code so far Im really confused:
Code:

#!/bin/bash
 

start=1
while [ $start=1 ]
do
P1=$(zenity --forms --text "Employment Information" --title= "Employment Information" --add-entry="Employee Full name" --add-entry="Employee Username" --add-calendar="Date of Birth" --add-list="Select Department" --list-values="HUMAN RESOURCE|FINANCE|SALES|INFOTECH|LOGISTICS" --add-password="Password:" --add-combo="Select Education" --combo-values="Grade 12|Diploma|Adv. Diploma|Graduate|Masters" --separator=: >> emplist.txt)

P2=$(zenity --list --checklist  --title="Technicial Certifications" --text="Select cerifications achieved:" --column="Acquired" --column="Certifications" FALSE "RHCSA" FALSE "RHCSE" FALSE "MCSA" FALSE "CCNA" FALSE "CCNP" FALSE "ITIL" FALSE "PMP" >> emplist.txt)

P3=$(zenity --list  --title "Drivers License" --text "Select Drivers License level: " --radiolist  --column "Acquired/Passed" --column "License level" FALSE "G1" FALSE "G2" FALSE "G" >> emplist.txt)

P4=$(zenity --question --title " " --text "Make another account")

P5=$(zenity --text-info --filename="emplist.txt")

done

In short I need to:

-Make the name inputted in the first entry of the first zenity form prompt appear on the question prompt (P4)
-When I say No on the question prompt(P4) it should redirect me to P5 to show emplist.txt
-When I say yes on the question prompt(P4) it should redirect back to P1 to make another account
-Ok/Cancel should close P5 when pressed
-P2 and P3 should stdout to emplist.txt WITHOUT making a new line and adding to P1s line

Thank you so much
:)

zvlo 11-27-2016 09:16 PM

Hello
I made this code for a zenity program and need help accomplishing some tasks.
In short I need to:

-Make the name inputted in the first entry of the first zenity form prompt appear on the question prompt (P4)
-When I say No on the question prompt(P4) it should redirect me to P5 to show emplist.txt
-When I say yes on the question prompt(P4) it should redirect back to P1 to make another account
-Ok/Cancel should close P5 when pressed
-P2 and P3 should stdout to emplist.txt WITHOUT making a new line and adding to P1s line

Here is the code (I am really confused):
Code:

#!/bin/bash
 

start=1
while [ $start=1 ]
do
P1=$(zenity --forms --text "Employment Information" --title= "Employment Information" --add-entry="Employee Full name" --add-entry="Employee Username" --add-calendar="Date of Birth" --add-list="Select Department" --list-values="HUMAN RESOURCE|FINANCE|SALES|INFOTECH|LOGISTICS" --add-password="Password:" --add-combo="Select Education" --combo-values="Grade 12|Diploma|Adv. Diploma|Graduate|Masters" --separator=: >> emplist.txt)

P2=$(zenity --list --checklist  --title="Technicial Certifications" --text="Select cerifications achieved:" --column="Acquired" --column="Certifications" FALSE "RHCSA" FALSE "RHCSE" FALSE "MCSA" FALSE "CCNA" FALSE "CCNP" FALSE "ITIL" FALSE "PMP" >> emplist.txt)

P3=$(zenity --list  --title "Drivers License" --text "Select Drivers License level: " --radiolist  --column "Acquired/Passed" --column "License level" FALSE "G1" FALSE "G2" FALSE "G" >> emplist.txt)

P4=$(zenity --question --title " " --text "Make another account")

P5=$(zenity --text-info --filename="emplist.txt")

done


Thank you so much

zvlo 11-27-2016 09:17 PM

If anymore screenshots are needed about the zenity programs like P1, P2 and P3 please let me know or just run them yourself they work

Habitual 11-28-2016 06:21 AM

When is the test?

rtmistler 11-28-2016 07:09 AM

Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.

zvlo 11-28-2016 09:09 AM

Quote:

Originally Posted by Habitual (Post 5635316)
When is the test?

Quote:

Originally Posted by rtmistler (Post 5635339)
Per the LQ Rules, please do not post homework assignments verbatim. We're happy to assist if you have specific questions or have hit a stumbling point, however. Let us know what you've already tried and what references you have used (including class notes, books, and Google searches) and we'll do our best to help. Also, keep in mind that your instructor might also be an LQ member.

Habitual - Its an assignment lol

rtmistler - Okay I deleted the original pictures of the questions and just left the questions I have about the code.

rtmistler 11-28-2016 10:48 AM

What you've written is not a working script, it is a handful of variable assignments and nothing further.

You need to determine how you can see the output of your first zenith command, to get it to the shell script. Once you know that, you can assign that to a variable and test the variable. You may end up needing to save it to a variable using some other means, for instance capturing the data from stdin as a user enters it.

My signature has a few BASH script references to aid you in better understanding BASH scripting. I also have a blog entry which talks about some ways to debug your scripts.

Some suggestions are to (1) remove the loop and all the following commands and just worry about the first command (2) remember that anything you can type and run from the terminal command line, you can put into a BASH script, and likewise any returns or status you get back you can save as a variable and test withing the BASH script (3) please put in some additional effort to find out how to get the desired output from your first command, I do not have or use zenith and therefore can only assess the flow of your script, which as I've said presently, does not have a flow, it is instead an infinite loop of variable definitions.

To be more effective, you may wish to review the information on good question guidelines for LQ, as well.

Habitual 11-28-2016 10:52 AM

http://linux.byexamples.com/archives...og-examples-1/
http://www.howtogeek.com/107537/how-...nity-on-linux/
are where I started in 2007.


All times are GMT -5. The time now is 03:09 PM.