LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   XMESSAGE -- Possible to Change Return Codes?? (https://www.linuxquestions.org/questions/linux-newbie-8/xmessage-possible-to-change-return-codes-893023/)

mrm5102 07-21-2011 03:48 PM

XMESSAGE -- Possible to Change Return Codes??
 
Hey All,

So I'm writing a little shell script and in it I'm using "xmessage" to get back input from the user.

The user will get a msg box that could have 3 or 4 different messages in the msg box depending on the situation.
And I am using a "case" statement to handle the return codes from xmessage's 3 or 4 different buttons that it could have.

Depending upon the situation it could show either 3 or 4 buttons.
I would like to only keep one case statement to handle the return codes because it could get pretty cumbersome to have 4 different case statements, one for each msg box.

So my question is: Would it be possible to define what the return codes would be for each button manually???
(by default if you have 4 buttons the return codes would be (from button 1 to 4) 101,102,103,104)
Code:

For Example:
                ##################################################
                #              MSG BOX 1                        #
                #    .          .          .          .      #
    Buttons --> # |Button 1|  |Button 2|  |Button 3|  |Button 4| #
Return Codes --> #    101        102        103        104    #
                ##################################################



                ##############################################
                #            MSG BOX 2                      #
                #    .          .          .              #
    Buttons --> # |Button 1|  |Button 2|  |Button 3|        #
Return Codes --> #    101        102        104            #
                ##############################################

Thanks in Advance,
Matt

David the H. 07-21-2011 08:28 PM

Did you not notice the phrase "by default"? Perhaps you should read the man page a bit more carefully.
Quote:

-buttons button,button,...
This option will cause xmessage to create one button for each comma-separated button argument. The corresponding resource is buttons. Each button consists of a label optionally followed by a colon and an exit value.

Code:

xmessage -buttons foo:105,bar:106,baz:107 message

mrm5102 07-22-2011 08:12 AM

David,

Hey David, thanks for the reply.

Haha yea, I guess I must have overlooked that. I did read through the man page but I guess I just didn't see that.
Well anyway, thanks for your help. Much appreciated.


Thanks,
Matt


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