Little Girl's Mostly Linux Blog

KDialog

KDialog

This page was last updated on January 20, 2017.

This page has examples of KDialog commands being used in scripts. Please read through that page since it has a tutorial that explains quite a bit about KDialog. There are subtle differences in the scripts used on this page, so please read the commented descriptions in each one.
Some examples below use HTML line break tags (the
element). You could use \n to insert a newline into some of them, but since not all of them accept it, it’s not demonstrated below. Many examples below use command substitution to combine commands.
Basic text has been used in the examples below, and the actions taken in all of the scripts are either to display a KDialog window with a message in it or to use the Bash sleep command to pause the script for a second or so. You can customize the scripts by changing the text and/or adding text, by choosing different actions for the scripts to take, and/or by by combining the scripts into bigger scripts.
All the scripts below are available in this zip file. If you’d like to scan the file to be sure it’s not malicious, Jotti’s malware scan offers free online scanning of small files and uses 22 well known brands of scanners. I also recommend that you read through each script so that you know exactly what it will do before you run it.
Ksnapshot was used in Kubuntu 14.10 Utopic Unicorn with the default color scheme to take the screenshots below. I thought I’d spare you the hot pink screenshots I usually do… This time.
As always, if you find errors or inconsistencies, or have suggestions for how this page can be improved, please let me know in the comment box at the bottom of the page or by email with the link in the upper right corner of the page.
Table of Contents

Checklist

Checklist example 1:
#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it displays a KDialog message box that         #
# corresponds to the value (key or, in this example, option number) you      #
# chose. In this example, each choice displays a custom message. The RED     #
# label has a value of "1" and the YELLOW label has a value of "2" and the   #
# GREEN label has a value of "3" and any combination of one or more of them  #
# can be chosen.                                                             #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script displays the kdialog command usage  #
# text in the terminal window if the script was run from a terminal window.  #
# If the script was made executable and was clicked to run or run from a     #
# shortcut, then nothing happens when an invalid choice was made. Note that  #
# this behavior is not controlled by the script, but is handled directly by  #
# the kdialog command.                                                       #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$choice";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Checklist example 2:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a checklist from which to make one # # or more choices. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The checklist returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # if section. In this example it displays a KDialog message box that # # corresponds to the value (key or, in this example, option number) you # # chose. In this example, each choice displays a custom message. The RED # # label has a value of "1" and the YELLOW label has a value of "2" and the # # GREEN label has a value of "3" and any combination of one or more of them # # can be chosen. # # # # If an invalid choice was made (no choices were made and the Enter key or # # the OK button was pressed), the script displays the kdialog command usage # # text in the terminal window if the script was run from a terminal window. # # If the script was made executable and was clicked to run or run from a # # shortcut, then nothing happens when an invalid choice was made. Note that # # this behavior is not controlled by the script, but is handled directly by # # the kdialog command. # # # # The checklist returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # elif section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off); if [ "$?" = 0 ]; then kdialog --msgbox "$choice"; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Checklist example 3:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it displays a KDialog message box that         #
# corresponds to the value (key or, in this example, option number) you      #
# chose. In this example each choice displays a custom message. Since the    #
# --separate-output option was used with the kdialog command, The RED label  #
# has a value of 1 and the YELLOW label has a value of 2 and the GREEN label #
# has a value of 3 and any combination of one or more of them can be chosen. #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script displays the kdialog command usage  #
# text in the terminal window if the script was run from a terminal window.  #
# If the script was made executable and was clicked to run or run from a     #
# shortcut, then nothing happens when an invalid choice was made. Note that  #
# this behavior is not controlled by the script, but is handled directly by  #
# the kdialog command.                                                       #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --separate-output --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2  "YELLOW" off 3 "GREEN" off);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$choice";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Checklist example 4:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it displays a KDialog message box that          #
# corresponds to the value (key or, in this example, option number) you      #
# chose. In this example, each choice displays a custom message. The RED     #
# label has a value of "1" and the YELLOW label has a value of "2" and the   #
# GREEN label has a value of "3" and any combination of one or more of them  #
# can be chosen.                                                             #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script displays the KDialog usage text in  #
# the terminal window if the script was run from a terminal window. If the   #
# script was made executable and was clicked to run or run from a shortcut,  #
# then nothing happens when an invalid choice was made. Note that this       #
# behavior is not controlled by the script, but is handled directly by the   #
# kdialog command.                                                           #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern - in this example it displays a KDialog sorry message.           #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern - in this example it displays a KDialog error message.       #
##############################################################################

choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off);

case "$?" in
	0)
		kdialog --msgbox "$choice";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Checklist example 5:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a checklist from which to make one # # or more choices. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The checklist returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # 0 pattern. In this example it displays a KDialog message box that # # corresponds to the value (key or, in this example, option number) you # # chose. In this example, each choice displays a custom message. The RED # # label has a value of "1" and the YELLOW label has a value of "2" and the # # GREEN label has a value of "3" and any combination of one or more of them # # can be chosen. # # # # If an invalid choice was made (no choices were made and the Enter key or # # the OK button was pressed), the script displays the kdialog command usage # # text in the terminal window if the script was run from a terminal window. # # If the script was made executable and was clicked to run or run from a # # shortcut, then nothing happens when an invalid choice was made. Note that # # this behavior is not controlled by the script, but is handled directly by # # the kdialog command. # # # # The checklist returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # 1 pattern - in this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern - in this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off); case "$?" in 0) kdialog --msgbox "$choice"; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Checklist example 6:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it displays a KDialog message box that          #
# corresponds to the value (key or, in this example, option number) you      #
# chose. In this example, each choice displays a custom message. Since the   #
# --separate-output option was used with the kdialog command, The RED label  #
# has a value of "1" and the YELLOW label has a value of "2" and the GREEN   #
# label has a value of "3" and any combination of one or more of them can be #
# chosen.                                                                    #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script displays the kdialog command usage  #
# text in the terminal window if the script was run from a terminal window.  #
# If the script was made executable and was clicked to run or run from a     #
# shortcut, then nothing happens when an invalid choice was made. Note that  #
# this behavior is not controlled by the script, but is handled directly by  #
# the kdialog command.                                                       #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern - in this example it displays a KDialog sorry message.           #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern - in this example it displays a KDialog error message.       #
##############################################################################

choice=$(kdialog --separate-output --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2  "YELLOW" off 3 "GREEN" off);

case "$?" in
	0)
		kdialog --msgbox "$choice";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Checklist example 7:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it evaluates the length of the $choice         #
# variable's value to determine if a valid choice was made (if one or more   #
# choices were made).                                                        #
#                                                                            #
# If a valid choice was made, the script executes the action you assigned to #
#  the nested if section. In this example it displays a KDialog message box  #
# that corresponds to the value (key or, in this example, option number) you #
# chose. In this example, each choice displays a custom message. The RED     #
# label has a value of "1" and the YELLOW label has a value of "2" and the   #
# GREEN label has a value of "3" and any combination of one or more of them  #
# can be chosen.                                                             #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script executes the action you assigned to #
# the nested else section. In this example it displays a KDialog sorry       #
# message.                                                                   #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off);

if [ "$?" = 0 ]; then
	if [ $(expr length "$choice") != 0 ]; then
		for result in $choice
			do
				if [ $result = '"1"' ]; then
					kdialog --msgbox "YOU CHOSE RED";
				fi;
				if [ $result = '"2"' ]; then
					kdialog --msgbox "YOU CHOSE YELLOW";
				fi;
				if [ $result = '"3"' ]; then
					kdialog --msgbox "YOU CHOSE GREEN";
				fi;
			done;
	else
		kdialog --sorry "NO SELECTION WAS MADE";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Checklist example 8:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a checklist from which to make one # # or more choices. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The checklist returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # if section. In this example it evaluates the length of the $choice # # variable's value to determine if a valid choice was made (if one or more # # choices were made). # # # # If a valid choice was made, the script executes the action you assigned to # # the nested if section. In this example it displays a KDialog message box # # that corresponds to the value (key or, in this example, option number) you # # chose. In this example, each choice displays a custom message. The RED # # label has a value of "1" and the YELLOW label has a value of "2" and the # # GREEN label has a value of "3" and any combination of one or more of them # # can be chosen. # # # # If an invalid choice was made (no choices were made and the Enter key or # # the OK button was pressed), the script executes the action you assigned to # # the nested else section. It displays a KDialog sorry message. # # # # The checklist returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # elif section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off); if [ "$?" = 0 ]; then if [ $(expr length "$choice") != 0 ]; then for result in $choice do if [ $result = '"1"' ]; then kdialog --msgbox "YOU CHOSE RED"; fi; if [ $result = '"2"' ]; then kdialog --msgbox "YOU CHOSE YELLOW"; fi; if [ $result = '"3"' ]; then kdialog --msgbox "YOU CHOSE GREEN"; fi; done; else kdialog --sorry "NO SELECTION WAS MADE"; fi; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Checklist example 9:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it evaluates the length of the $choice         #
# variable's value to determine if a valid choice was made (if one or more   #
# choices were made).                                                        #
#                                                                            #
# If a valid choice was made, the script executes the action you assigned to #
# the nested if section. In this example it displays a KDialog message box   #
# that corresponds to the value (key or, in this example, option number) you #
# chose. In this example, each choice displays a custom message. Since the   #
# --separate-output option was used with the kdialog command, The RED label  #
# has a value of 1 and the YELLOW label has a value of 2 and the GREEN label #
# has a value of 3 and any combination of one or more of them can be chosen. #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script executes the action you assigned to #
# the nested else section. In this example it displays a KDialog sorry       #
# message.                                                                   #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --separate-output --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" off 2  "YELLOW" off 3 "GREEN" off);

if [ "$?" = 0 ]; then
	if [ $(expr length "$choice") != 0 ]; then
		for result in $choice
			do
				if [ $result = '1' ]; then
					kdialog --msgbox "YOU CHOSE RED";
				fi;
				if [ $result = '2' ]; then
					kdialog --msgbox "YOU CHOSE YELLOW";
				fi;
				if [ $result = '3' ]; then
					kdialog --msgbox "YOU CHOSE GREEN";
				fi;
			done
	else
		kdialog --sorry "NO SELECTION WAS MADE";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Checklist example 10:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it evaluates the length of the $choice          #
# variable's value to determine if a valid choice was made (if one or more   #
# choices were made).                                                        #
#                                                                            #
# If a valid choice was made, the script executes the action you assigned to #
#  the nested * pattern. In this example it displays a KDialog message box   #
# that corresponds to the value (key or, in this example, option number) you #
# chose. In this example, each choice displays a custom message. The RED     #
# label has a value of "1" and the YELLOW label has a value of "2" and the   #
# GREEN label has a value of "3" and any combination of one or more of them  #
# can be chosen.                                                             #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script executes the action you assigned to #
# the nested 0 pattern. In this example it displays a KDialog sorry message. #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off);

case $? in
	0)
		case $(expr length "$choice") in
			0) 
				kdialog --sorry "NO SELECTION WAS MADE";
				;;
			*)
				for result in $choice
					do
						case $result in
							'"1"')
								kdialog --msgbox "YOU CHOSE RED";
								;;
							'"2"')
								kdialog --msgbox "YOU CHOSE YELLOW";
								;;
							'"3"')
								kdialog --msgbox "YOU CHOSE GREEN";
								;;
						esac;
					done
					;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Checklist example 11:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a checklist from which to make one # # or more choices. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The checklist returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # 0 pattern. In this example it evaluates the length of the $choice # # variable's value to determine if a valid choice was made (if one or more # # choices were made). # # # # If a valid choice was made, the script executes the action you assigned to # # the nested * pattern. In this example it displays a KDialog message box # # that corresponds to the value (key or, in this example, option number) you # # chose. In this example, each choice displays a custom message. The RED # # label has a value of "1" and the YELLOW label has a value of "2" and the # # GREEN label has a value of "3" and any combination of one or more of them # # can be chosen. # # # # If an invalid choice was made (no choices were made and the Enter key or # # the OK button was pressed), the script executes the action you assigned to # # the nested 0 pattern. In this example it displays a KDialog sorry message. # # # # The checklist returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # 1 pattern. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" on 2 "YELLOW" off 3 "GREEN" off); case $? in 0) case $(expr length "$choice") in 0) kdialog --sorry "NO SELECTION WAS MADE"; ;; *) for result in $choice do case $result in '"1"') kdialog --msgbox "YOU CHOSE RED"; ;; '"2"') kdialog --msgbox "YOU CHOSE YELLOW"; ;; '"3"') kdialog --msgbox "YOU CHOSE GREEN"; ;; esac; done ;; esac; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Checklist example 12:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it evaluates the length of the $choice          #
# variable's value to determine if a valid choice was made (if one or more   #
# choices were made).                                                        #
#                                                                            #
# If a valid choice was made, the script executes the action you assigned to #
#  the nested * pattern. In this example it displays a KDialog message box   #
# that corresponds to the value (key or, in this example, option number) you #
# chose. In this example, each choice displays a custom message. Since the   #
# --separate-output option was used with the KDialog command, the RED label  #
# has a value of 1 and the YELLOW label has a value of 2 and the GREEN label #
# has a value of 3 and any combination of one or more of them can be chosen. #
#                                                                            #
# If an invalid choice was made (no choices were made and the Enter key or   #
# the OK button was pressed), the script executes the action you assigned to #
# the nested 0 pattern. In this example it displays a KDialog sorry message. #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --separate-output --checklist "CHOOSE ONE OR MORE COLORS:" 1 "RED" off 2  "YELLOW" off 3 "GREEN" off);

case $? in
	0)
		case $(expr length "$choice") in
			0)
				kdialog --sorry "NO SELECTION WAS MADE";
				;;
			*)
				for result in $choice
					do
						case $result in
							'1')
								kdialog --msgbox "YOU CHOSE RED";
								;;
							'2')
								kdialog --msgbox "YOU CHOSE YELLOW";
								;;
							'3')
								kdialog --msgbox "YOU CHOSE GREEN";
								;;
						esac;
					done;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Checklist example 13:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The mouse or the arrow keys and space bar can be used to make your         #
# choice(s) from the selection.                                              #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it displays a KDialog CORRECT message box if   #
# you chose the first two items, or it displays an INCORRECT message if no   #
# choice or any other choice was made.                                       #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
#                                                                            #
# IMPORTANT: When more than one choice is made, KDialog stores the combined  #
# value of the choices with an added space at the end. For example, if you   #
# want to test whether the first two choices were made, this test will not   #
# work:                                                                      #
#                     if [ "$variable" = '"1" "2"' ];                        #
# This test will work:                                                       #
#                     if [ "$variable" = '"1" "2" ' ];                       #
##############################################################################

variable=$(kdialog --checklist "CHOOSE ALL THAT APPLY:" 1 "RED" off 2 "YELLOW" off 3 "GREEN" off);

if [ "$?" = 0 ]; then
	if [ "$variable" = '"1" "2" ' ]; then
		kdialog --msgbox "CORRECT";
	else
		kdialog --sorry "INCORRECT";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Checklist example 14:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a checklist from which to make one or more choices. Command            #
# substitution is used to save your choice to a variable. The script then    #
# tests the exit status of the command.                                      #
#                                                                            #
# The mouse or the arrow keys and space bar can be used to make your         #
# choice(s) from the selection.                                              #
#                                                                            #
# The checklist returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it displays a KDialog CORRECT message box if    #
# you chose the first two items, or it displays an INCORRECT message if no   #
# choice or any other choice was made.                                       #
#                                                                            #
# The checklist returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# * pattern. In this example it displays a KDialog error message.            #
#                                                                            #
# IMPORTANT: When more than one choice is made, KDialog stores the combined  #
# value of the choices with an added space at the end. For example, if you   #
# want to test whether the first two choices were made, this test will not   #
# work:                                                                      #
#		case "$choice" in                                            #
#			'"1" "2"')                                           #
# This test will work:                                                       #
#		case "$choice" in                                            #
#			'"1" "2" ')                                          #
##############################################################################

choice=$(kdialog --checklist "CHOOSE ALL THAT APPLY:" 1 "RED" off 2 "YELLOW" off 3 "GREEN" off);

case "$?" in
	0)
		case "$choice" in
			'"1" "2" ')
				kdialog --msgbox "CORRECT";
				;;
			*)
				kdialog --sorry "INCORRECT";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Combo box

Combo box example 1:
#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a combo box from which to make a choice. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status   #
# of the command.                                                            #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it executes the action you assigned to the     #
# nested if or nested elif section that corresponds to the value (text or    #
# label) that was chosen and displays a KDialog message box letting you know #
# which color you chose.                                                     #
#                                                                            #
# If an invalid choice was made (no choice was made and the Enter key or the #
# OK button was pressed), the script executes the action you assigned to the #
# nested else section. In this example it displays a KDialog sorry message.  #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN");

if [ "$?" = 0 ]; then
	if [ "$choice" = RED ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = YELLOW ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = GREEN ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --sorry "YOU DID NOT CHOOSE A COLOR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Combo box example 2:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a combo box from which to make a # # choice. Command substitution is used to save your choice to a variable. # # The script then tests the exit status of the command. # # # # The combo box returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # if section. In this example it executes the action you assigned to the # # nested if or nested elif section that corresponds to the value (text or # # label) that was chosen and displays a KDialog message box letting you know # # which color you chose. # # # # If an invalid choice was made (no choices were chosen and the Enter key or # # the OK button was pressed), the script executes the action you assigned to # # the nested else section. In this example it displays a KDialog sorry # # message. # # # # The combo box returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # elif section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --combobox "CHOOSE A COLOR" "RED" "YELLOW" "GREEN"); if [ "$?" = 0 ]; then if [ "$choice" = RED ]; then kdialog --msgbox "YOU CHOSE RED"; elif [ "$choice" = YELLOW ]; then kdialog --msgbox "YOU CHOSE YELLOW"; elif [ "$choice" = GREEN ]; then kdialog --msgbox "YOU CHOSE GREEN"; else kdialog --sorry "YOU DID NOT CHOOSE A COLOR"; fi; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Combo box example 3:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a combo box from which to make a choice. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status   #
# of the command.                                                            #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it executes the action you assigned to the      #
# nested RED, YELLOW, or GREEN pattern that corresponds to the value (text   #
# or label) that was chosen and displays a KDialog message box letting you   #
# know which color you chose.                                                #
#                                                                            #
# If an invalid choice was made (no choices were chosen and the Enter key or #
# the OK button was pressed), the script executes the action you assigned to #
# the nested * pattern. In this example it displays a KDialog sorry message. #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN");

case "$?" in
	0)
		case "$choice" in
			RED)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			YELLOW)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			GREEN)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --sorry "YOU DID NOT CHOOSE A COLOR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Combo box example 4:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a combo box from which to make a # # choice. Command substitution is used to save your choice to a variable. # # The script then tests the exit status of the command. # # # # The combo box returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # 0 pattern. In this example it executes the action you assigned to the # # nested RED, YELLOW, or GREEN pattern that corresponds to the value (text # # or label) that was chosen and displays a KDialog message box letting you # # know which color you chose. # # # # If an invalid choice was made (no choices were chosen and the Enter key or # # the OK button was pressed), the script executes the action you assigned to # # the nested * pattern. In this example it displays a KDialog sorry message. # # # # The combo box returns a 1 exit code if the Esc key or Cancel button is # # pressed. In that case, the script executes the action you assigned to the # # 1 pattern. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --combobox "CHOOSE A COLOR" "RED" "YELLOW" "GREEN"); case "$?" in 0) case "$choice" in RED) kdialog --msgbox "YOU CHOSE RED"; ;; YELLOW) kdialog --msgbox "YOU CHOSE YELLOW"; ;; GREEN) kdialog --msgbox "YOU CHOSE GREEN"; ;; *) kdialog --sorry "YOU DID NOT CHOOSE A COLOR"; ;; esac; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Combo box example 5:

#!/bin/bash

##############################################################################
# This script contains a function that opens a KDialog window with a         #
# single-line message that offers you a combo box from which to make a       #
# choice. Command substitution is used to save your choice to a variable.    #
# The script then tests the exit status of the command.                      #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it executes the action you assigned to the     #
# nested if or nested elif section that corresponds to the value (text or    #
# label) that was chosen and displays a KDialog message box letting you know #
# which color you chose.                                                     #
#                                                                            #
# If an invalid choice was made (no choices were chosen and the Enter key or #
# the OK button was pressed), the script executes the action you assigned to #
# the nested else section. In this example it executes the function in this  #
# script to present the user with the same choice again.                     #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

JOB () {
	choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN");

	if [ "$?" = 0 ]; then
		if [ "$choice" = RED ]; then
			kdialog --msgbox "YOU CHOSE RED";
		elif [ "$choice" = YELLOW ]; then
			kdialog --msgbox "YOU CHOSE BLUE";
		elif [ "$choice" = GREEN ]; then
			kdialog --msgbox "YOU CHOSE GREEN";
		else
			JOB;
		fi;
	elif [ "$?" = 1 ]; then
		kdialog --sorry "YOU CHOSE CANCEL";
	else
		kdialog --error "ERROR";
	fi;
	}
JOB;

Back to top

Combo box example 6:

#!/bin/bash

##############################################################################
# This script contains a function that opens a KDialog window with a         #
# single-line message that offers you a combo box from which to make a       #
# choice. Command substitution is used to save your choice to a variable.    #
# The script then tests the exit status of the command.                      #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it executes the action you assigned to the      #
# nested RED, YELLOW, or GREEN pattern that corresponds to the value (text   #
# or label) that was chosen and displays a KDialog message box letting you   #
# know which color you chose.                                                #
#                                                                            #
# If an invalid choice was made (no choices were chosen and the Enter key or #
# the OK button was pressed), the script executes the action you assigned to #
# the nested * pattern. In this example it executes the function in this     #
# script to present the user with the same choice again.                     #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

JOB () {
	choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN");

	case "$?" in
		0)
			case "$choice" in
				RED)
					kdialog --msgbox "YOU CHOSE RED";
					;;
				YELLOW)
					kdialog --msgbox "YOU CHOSE YELLOW";
					;;
				GREEN)
					kdialog --msgbox "YOU CHOSE GREEN";
					;;
				*)
					JOB;
					;;
			esac;
			;;
		1)
			kdialog --sorry "YOU CHOSE CANCEL";
			;;
		*)
			kdialog --error "ERROR";
			;;
	esac;
	}
JOB;

Back to top

Combo box example 7:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a combo box from which to make a choice. Since the --default option    #
# was used, "RED" has been selected by default. You can choose "RED" or      #
# another color. Command substitution is used to save your choice to a       #
# variable. The script then tests the exit status of the command.            #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# if section. In this example it executes the action you assigned to the     #
# nested if or nested elif section that corresponds to the value (text or    #
# label) that was chosen and displays a KDialog message box letting you know #
# which color you chose.                                                     #
#                                                                            #
# If an unexpected error occurs while making a choice, the script executes   #
# the action you assigned to the nested else section. In this example it     #
# displays a KDialog error message.                                          #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN" --default "RED");

if [ "$?" = 0 ]; then
	if [ "$choice" = RED ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = YELLOW ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = GREEN ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Combo box example 8:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a combo box from which to make a choice. Since the --default option    #
# was used, "RED" has been selected by default. You can choose "RED" or      #
# another color. Command substitution is used to save your choice to a       #
# variable. The script then tests the exit status of the command.            #
#                                                                            #
# The combo box returns a 0 exit code if the Enter key or the OK button is   #
# pressed. In that case, the script executes the action you assigned to the  #
# 0 pattern. In this example it executes the action you assigned to the      #
# nested RED, YELLOW, or GREEN pattern that corresponds to the value (text   #
# or label) that was chosen and displays a KDialog message box letting you   #
# know which color you chose.                                                #
#                                                                            #
# If an unexpected error occurs while making a choice, the script executes   #
# the action you assigned to the nested * pattern. In this example it        #
# displays a KDialog error message.                                          #
#                                                                            #
# The combo box returns a 1 exit code if the Esc key or Cancel button is     #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --combobox "CHOOSE A COLOR:" "RED" "YELLOW" "GREEN" --default "RED");

case "$?" in
	0)
		case "$choice" in
			RED)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			YELLOW)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			GREEN)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --sorry "YOU DID NOT CHOOSE A COLOR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Error

Error example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your single-line error     #
# message. The command always returns a 0 exit code.                          #
###############################################################################

kdialog --error "YOUR MESSAGE HERE";

Back to top

Error example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your multiple-line error   #
# message. The HTML 
tag is used to add a carriage return. The command # # always returns a 0 exit code. # ############################################################################### kdialog --error "YOUR MESSAGE HERE";

Back to top

Error example 3:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog window that displays your single-line    #
# error message with a title. The command always returns a 0 exit code.       #
###############################################################################

kdialog --error "YOUR MESSAGE HERE" --title "YOUR TITLE HERE";

Back to top

Get existing directory

Get existing directory example 1:
#!/bin/bash

##############################################################################
# This script opens a KDialog window that lets you browse to a directory or  #
# create a new one and browse to it. Command substitution is used to capture #
# the name of the directory you chose or created. The script then tests the  #
# exit status of the command.                                                #
#                                                                            #
# The command returns a 0 exit code if the New Folder... button is used to   #
# create a new folder and then the OK button or the Enter key is pressed, or #
# if an existing folder is selected and the OK button or the Enter key is    #
# pressed. The script then executes the action you assigned to the if        #
# section. In this example it displays a KDialog message box with the path   #
# to the folder you chose or created.                                        #
#                                                                            #
# The command returns a 1 exit code if the Esc key or Cancel button is       #
# pressed. In that case, the script executes the action you assigned to the  #
# elif section. In this example it displays a KDialog sorry message.         #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

variable=$(kdialog --getexistingdirectory *);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get existing directory example 2:

#!/bin/bash

##############################################################################
# This script opens a KDialog window that lets you browse to a directory or  #
# create a new one and browse to it. Command substitution is used to capture #
# the name of the directory you chose or created. The script then tests the  #
# exit status of the command.                                                #
#                                                                            #
# The command returns a 0 exit code if the New Folder... button is used to   #
# create a new folder and then the OK button or the Enter key is pressed, or #
# if an existing folder is selected and the OK button or the Enter key is    #
# pressed. The script then executes the action you assigned to the 0         #
# pattern. In this example it displays a KDialog message box with the path   #
# to the folder you chose or created.                                        #
#                                                                            #
# The command returns a 1 exit code if the Esc key or Cancel button is       #
# pressed. In that case, the script executes the action you assigned to the  #
# 1 pattern. In this example it displays a KDialog sorry message.            #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

variable=$(kdialog --getexistingdirectory *);

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Get open file name

Get open file name example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file to open starting in the current directory. Command substitution is   #
# used to save the path to the chosen file to a variable. The script then     #
# tests the exit status of the command.                                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message   #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getopenfilename .);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get open file name example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file to open starting in the current directory. Command substitution is   #
# used to save the path to the chosen file to a variable. The script then     #
# tests the exit status of the command.                                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the 0 pattern. In this example it displays a KDialog message    #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --getopenfilename .);

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Get open file name example 3:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file to open starting in the specified directory (in this example it's    #
# the /PATH/ directory). Command substitution is used to save the path to the #
# chosen file to a variable. The script then tests the exit status of the     #
# command.                                                                    #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message   #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code  if the Esc key or Cancel button  #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getopenfilename /PATH/.);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get open file name example 4:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file with the specified extension (in this example the .txt and .html     #
# extensions are used) to open starting in the current directory. Command     #
# substitution is used to save the path to the file you choose to a variable. #
# The script then tests the exit status of the command.                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message   #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code  if the Esc key or Cancel button  #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getopenfilename . "*.txt *.html");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get open file name example 5:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file of the specified mime type (this example uses the image/png mime     #
# type) to open starting in the current directory. Command substitution is    #
# used to save the path to the file you choose to a variable. The script then #
# tests the exit status of the command.                                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message   #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code  if the Esc key or Cancel button  #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getopenfilename . "image/png");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get open file name example 6:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to choose #
# a file of the specified mime type (in this example the image/png, the       #
# txt/html, and the text/plain mime types are used) to open starting in the   #
# current directory. Command substitution is used to save the path to the     #
# file you choose to a variable. The script then tests the exit status of the #
# command.                                                                    #
#                                                                             #
# The kdialog command returns a 0 exit code if the Open button is pressed or  #
# if the Enter key is pressed when a file name has been selected or if a file #
# name is double-clicked. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message   #
# box that displays the contents of the variable that contains your choice.   #
#                                                                             #
# The kdialog command returns a 1 exit code  if the Esc key or Cancel button  #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getopenfilename . "image/png text/html text/plain");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get save file name

Get save file name example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file to be created in the current directory. Command   #
# substitution is used to save the path to the file in a variable. The script #
# then tests the exit status of the command.                                  #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the if section. In this      #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getsavefilename :);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get save file name example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file to be created in the current directory. Command   #
# substitution is used to save the path to the file in a variable. The script #
# then tests the exit status of the command.                                  #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the 0 pattern. In this       #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --getsavefilename :);

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
		
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Get save file name example 3:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file to be created in the specified directory (this    #
# example uses the /PATH/ directory). Command substitution is used to save    #
# the path to the file in a variable. The script then tests the exit status   #
# of the command.                                                             #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the if section. In this      #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getsavefilename /PATH/.);

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get save file name example 4:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file to be created in the specified directory (this    #
# example uses the /PATH/ directory). Command substitution is used to save    #
# the path to the file in a variable. The script then tests the exit status   #
# of the command.                                                             #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the 0 pattern. In this       #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --getsavefilename /PATH/.);

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
		
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Get save file name example 5:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file of the specified type (in this example files with #
# the .txt extension are acceptable) to be created in the current directory.  #
# Command substitution is used to save the path to the file in a variable.    #
# The script then tests the exit status of the command.                       #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the if section. In this      #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getsavefilename : "*.txt");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
	touch "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get save file name example 6:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file of the specified type (in this example files with #
# the .txt extension are acceptable) to be created in the current directory.  #
# Command substitution is used to save the path to the file in a variable.    #
# The script then tests the exit status of the command.                       #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the 0 pattern. In this       #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --getsavefilename : "*.txt");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
		
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Get save file name example 7:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file of the specified type (in this example files with #
# the .txt extension are acceptable) to be created in the current directory.  #
# A suggested name is supplied by the command. Command substitution is used   #
# to save the path to the file in a variable. The script then tests the exit  #
# status of the command.                                                      #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the if section. In this      #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --getsavefilename :SUGGESTEDNAME "*.txt");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
	touch "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Get save file name example 8:

#!/bin/bash

###############################################################################
# This script opens a KDialog file browsing window that expects you to        #
# provide a name for a file of the specified type (in this example files with #
# the .txt extension are acceptable) to be created in the current directory.  #
# A suggested name is supplied by the command. Command substitution is used   #
# to save the path to the file in a variable. The script then tests the exit  #
# status of the command.                                                      #
#                                                                             #
# The kdialog command returns a 0 exit code if a file is selected and the     #
# Save button is pressed, or if a file name is double-clicked. In that case,  #
# the script executes the action you assigned to the 0 pattern. In this       #
# example it displays a kdialog message box that displays the contents of the #
# variable that contains your choice.                                         #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --getsavefilename :SUGGESTEDNAME "*.txt");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
		
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Input box

Input box example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Command substitution is used to save your input to a #
# variable. The script then tests the exit status of the command.             #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the if section. In this example it displays a KDialog message box that      #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action you assigned to    #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Input box example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Command substitution is used to save your input to a #
# variable. The script then tests the exit status of the command.             #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the 0 pattern. In this example it displays a KDialog message box that       #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it dosplays a KDialog error message.         #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Input box example 3:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a two-line message (created by      #
# using an HTML 
tag) that asks you to type in some input. Command # # substitution is used to save your input to a variable. The script then # # tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Enter key or the OK button # # is pressed. In that case, the script executes the action you assigned to # # the if section. In this example it displays a KDialog message box that # # contains your input. # # # # The kdialog command returns a 1 exit code if the Esc key or Cancel button # # is pressed. In that case, the script executes the action you assigned to # # the elif section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################### variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT"); if [ "$?" = 0 ]; then kdialog --msgbox "$variable"; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Input box example 4:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a two-line message (created by      #
# using an HTML 
tag) that asks you to type in some input. Command # # substitution is used to save your input to a variable. The script then # # tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Enter key or the OK button # # is pressed. In that case, the script executes the action you assigned to # # the 0 pattern. In this example it displays a KDialog message box that # # contains your input. # # # # The kdialog command returns a 1 exit code if the Esc key or Cancel button # # is pressed. In that case, the script executes the action you assigned to # # the 1 pattern. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern In this example it displays a KDialog error message. # ############################################################################### variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT"); case "$?" in 0) kdialog --msgbox "$variable"; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Input box example 5:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Example input is provided in the input box. Command  #
# substitution is used to save your input to a variable. The script then      #
# tests the exit status of the command.                                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the if section. In this example it displays a KDialog message box that      #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action you assigned to    #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT" "DEFAULT");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Input box example 6:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Example input is provided in the input box. Command  #
# substitution is used to save your input to a variable. The script then      #
# tests the exit status of the command.                                       #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the 0 pattern. In this example it displays a KDialog message box that       #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action you assigned to    #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT" "DEFAULT");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Input box example 7:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog window with a single-line message that   #
# asks you to type in some input. Command substitution is used to save your   #
# input to a variable. The script then tests the exit status of the command.  #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the if section. In this example it displays a KDialog message box that      #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action you assigned to    #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT" --title "YOUR TITLE HERE");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Input box example 8:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog window with a single-line message that   #
# asks you to type in some input. Command substitution is used to save your   #
# input to a variable. The script then tests the exit status of the command.  #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the 0 pattern. In this example it displays a KDialog message box that       #
# contains your input.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action you assigned to    #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT" --title "YOUR TITLE HERE");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Input box example 9:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Command substitution is used to save your input to a #
# variable. The script then tests the exit status of the command.             #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the if section. In this example it writes your input to the file named      #
# FILENAME in the current directory, creating it if it doesn't exist and      #
# overwriting it if it does.                                                  #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the elif section. In this example it displays a KDialog sorry message.      #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT");

if [ "$?" = 0 ]; then
	echo "$variable" > FILENAME;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Input box example 10:

#!/bin/bash

###############################################################################
# This script opens a KDialog window with a single-line message that asks you #
# to type in some input. Command substitution is used to save your input to a #
# variable. The script then tests the exit status of the command.             #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or the OK button #
# is pressed. In that case, the script executes the action you assigned to    #
# the 0 pattern. In this example it writes your input to the file named       #
# FILENAME in the current directory, creating it if it doesn't exist and      #
# overwriting it if it does.                                                  #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key or Cancel button   #
# is pressed. In that case, the script executes the action in you assigned to #
# the 1 pattern. In this example it displays a KDialog sorry message.         #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

variable=$(kdialog --inputbox "PLEASE ENTER SOME TEXT");

case "$?" in
	0)
		echo "$variable" > FILENAME;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Menu

Menu example 1:
#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. Command substitution is used to    #
# save your choice to a variable. The script then tests the exit status of   #
# the command.                                                               #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested if section. In this example it displays a KDialog message box that  #
# corresponds to the value (in this example, the letter) you chose. In this  #
# example, each choice displays a custom message. The RED label has a value  #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a value #
# of 3 and only one can be chosen.                                           #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the elif      #
# section. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN");

if [ "$?" = 0 ]; then
	if [ "$choice" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Menu example 2:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. Command substitution is used to    #
# save your choice to a variable. The script then tests the exit status of   #
# the command.                                                               #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested case section. In this example it displays a KDialog message box     #
# that corresponds to the value (in this example, the letter) you chose. In  #
# this example, each choice displays a custom message. The RED label has a   #
# value of 1 and the YELLOW label has a value of 2 and the GREEN label has a #
# value of 3 and only one can be chosen.                                     #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the 1         #
# pattern. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN");

case "$?" in
	0)
		case "$choice" in
			1)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			2)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			3)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --error "ERROR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Menu example 3:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message that  #
# offers you a menu from which to make a choice. Command substitution is     #
# used to save your choice to a variable. The script then tests the exit     #
# status of the command.                                                     #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested if section. In this example it displays a KDialog message box that  #
# corresponds to the value (in this example, the letter) you chose. In this  #
# example, each choice displays a custom message. The RED label has a value  #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a value #
# of 3 and only one can be chosen.                                           #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the elif      #
# section. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN" --title "YOUR TITLE HERE");

if [ "$?" = 0 ]; then
	if [ "$choice" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Menu example 4:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message that  #
# offers you a menu from which to make a choice. Command substitution is     #
# used to save your choice to a variable. The script then tests the exit     #
# status of the command.                                                     #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested case section. In this example it displays a KDialog message box     #
# that corresponds to the value (in this example, the letter) you chose. In  #
# this example, each choice displays a custom message. The RED label has a   #
# value of 1 and the YELLOW label has a value of 2 and the GREEN label has a #
# value of 3 and only one can be chosen.                                     #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the 1         #
# pattern. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN" --title "YOUR TITLE HERE");

case "$?" in
	0)
		case "$choice" in
			1)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			2)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			3)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --error "ERROR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Menu example 5:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a menu from which to make a # # choice. Command substitution is used to save your choice to a variable. # # The script then tests the exit status of the command. # # # # The menu returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # nested if section. In this example it displays a KDialog message box that # # corresponds to the value (in this example, the letter) you chose. In this # # example, each choice displays a custom message. The RED label has a value # # of 1 and the YELLOW label has a value of 2 and the GREEN label has a value # # of 3 and only one can be chosen. # # # # The menu returns a 1 exit code if the Esc key or Cancel button is pressed. # # In that case, the script executes the action you assigned to the elif # # section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN"); if [ "$?" = 0 ]; then if [ "$choice" = 1 ]; then kdialog --msgbox "YOU CHOSE RED"; elif [ "$choice" = 2 ]; then kdialog --msgbox "YOU CHOSE YELLOW"; elif [ "$choice" = 3 ]; then kdialog --msgbox "YOU CHOSE GREEN"; else kdialog --error "ERROR"; fi; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Menu example 6:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) that offers you a menu from which to make a # # choice. Command substitution is used to save your choice to a variable. # # The script then tests the exit status of the command. # # # # The menu returns a 0 exit code if the Enter key or the OK button is # # pressed. In that case, the script executes the action you assigned to the # # nested case section. In this example it displays a KDialog message box # # that corresponds to the value (in this example, the letter) you chose. In # # this example, each choice displays a custom message. The RED label has a # # value of 1 and the YELLOW label has a value of 2 and the GREEN label has a # # value of 3 and only one can be chosen. # # # # The menu returns a 1 exit code if the Esc key or Cancel button is pressed. # # In that case, the script executes the action you assigned to the 1 # # pattern. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################## choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN"); case "$?" in 0) case "$choice" in 1) kdialog --msgbox "YOU CHOSE RED"; ;; 2) kdialog --msgbox "YOU CHOSE YELLOW"; ;; 3) kdialog --msgbox "YOU CHOSE GREEN"; ;; *) kdialog --error "ERROR"; ;; esac; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Menu example 7:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. Since the --default option was     #
# used, "RED" has been selected by default. You can choose "RED" or another  #
# color. Command substitution is used to save your choice to a variable. The #
# script then tests the exit status of the command.                          #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested if section. In this example it displays a KDialog message box that  #
# corresponds to the value (in this example, the letter) you chose. In this  #
# example, each choice displays a custom message. The RED label has a value  #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a value #
# of 3 and only one can be chosen.                                           #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the elif      #
# section. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN" --default "RED");

if [ "$?" = 0 ]; then
	if [ "$choice" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Menu example 8:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. Since the --default option was     #
# used, "RED" has been selected by default. You can choose "RED" or another  #
# color. Command substitution is used to save your choice to a variable. The #
# script then tests the exit status of the command.                          #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested case section. In this example it displays a KDialog message box     #
# that corresponds to the value (in this example, the letter) you chose. In  #
# this example, each choice displays a custom message. The RED label has a   #
# value of 1 and the YELLOW label has a value of 2 and the GREEN label has a #
# value of 3 and only one can be chosen.                                     #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the 1         #
# pattern. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" 1 "RED" 2 "YELLOW" 3 "GREEN" --default "RED");

case "$?" in
	0)
		case "$choice" in
			1)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			2)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			3)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --error "ERROR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Menu example 9:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. The menu is gotten by using        #
# command substitution to read the contents of a file (in this example I     #
# used FILENAME). Command substitution is used to save your choice to a      #
# variable. The script then tests the exit status of the command.            #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested if section. In this example it displays a KDialog message box that  #
# corresponds to the value (in this example, the letter) you chose. In this  #
# example, each choice displays a custom message. The RED label has a value  #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a value #
# of 3 and only one can be chosen.                                           #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the elif      #
# section. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" $(cat FILENAME));

if [ "$?" = 0 ]; then
	if [ "$choice" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Menu example 10:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. The menu is gotten by using        #
# command substitution to read the contents of a file (in this example I     #
# used FILENAME). Command substitution is used to save your choice to a      #
# variable. The script then tests the exit status of the command.            #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested case section. In this example it displays a KDialog message box     #
# that corresponds to the value (in this example, the letter) you chose. In  #
# this example, each choice displays a custom message. The RED label has a   #
# value of 1 and the YELLOW label has a value of 2 and the GREEN label has a #
# value of 3 and only one can be chosen.                                     #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the 1         #
# pattern. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

choice=$(kdialog --menu "CHOOSE ONE:" $(cat FILENAME));

case "$?" in
	0)
		case "$choice" in
			1)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			2)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			3)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --error "ERROR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Menu example 11:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. The menu is gotten by using        #
# command substitution to read the contents of a file (in this example I     #
# used FILENAME) and save them to a variable. Command substitution is used   #
# to save your choice to a variable. The script then tests the exit status   #
# of the command.                                                            #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested if section. In this example it displays a KDialog message box that  #
# corresponds to the value (in this example, the letter) you chose. In this  #
# example, each choice displays a custom message. The RED label has a value  #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a value #
# of 3 and only one can be chosen.                                           #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the elif      #
# section. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the else section. In this example it displays a KDialog error message.     #
##############################################################################

contents=$(cat FILENAME);
choice=$(kdialog --menu "CHOOSE ONE:" $contents);

if [ "$?" = 0 ]; then
	if [ "$choice" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$choice" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$choice" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Menu example 12:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message that offers  #
# you a menu from which to make a choice. The menu is gotten by using        #
# command substitution to read the contents of a file (in this example I     #
# used FILENAME) and save them to a variable. Command substitution is used   #
# to save your choice to a variable. The script then tests the exit status   #
# of the command.                                                            #
#                                                                            #
# The menu returns a 0 exit code if the Enter key or the OK button is        #
# pressed. In that case, the script executes the action you assigned to the  #
# nested case section. In this example it displays a KDialog message box     #
# that corresponds to the value (in this example, the letter) you chose. In  #
# this example, each choice displays a custom message. The RED label has a   #
# value of 1 and the YELLOW label has a value of 2 and the GREEN label has a #
# value of 3 and only one can be chosen.                                     #
#                                                                            #
# The menu returns a 1 exit code if the Esc key or Cancel button is pressed. #
# In that case, the script executes the action you assigned to the 1         #
# pattern. In this example it displays a KDialog sorry message.              #
#                                                                            #
# If anything else happens, the script executes the action you assigned to   #
# the * pattern. In this example it displays a KDialog error message.        #
##############################################################################

contents=$(cat FILENAME);
choice=$(kdialog --menu "CHOOSE ONE:" $contents);

case "$?" in
	0)
		case $choice in
			1)
				kdialog --msgbox "YOU CHOSE RED";
				;;
			2)
				kdialog --msgbox "YOU CHOSE YELLOW";
				;;
			3)
				kdialog --msgbox "YOU CHOSE GREEN";
				;;
			*)
				kdialog --error "ERROR";
				;;
		esac;
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Message box

Message box example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your single-line           #
# message box. The command always returns a 0 exit code.                      #
###############################################################################

kdialog --msgbox "YOUR MESSAGE HERE";

Back to top

Message box example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your two-line message box  #
# (created by using an HTML 
tag). The command always returns a 0 exit # # code. # ############################################################################### kdialog --msgbox "YOUR MESSAGE HERE";

Back to top

Message box example 3:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog window that displays your single-line    #
# message box. The command always returns a 0 exit code.                      #
###############################################################################

kdialog --msgbox "YOUR MESSAGE HERE" --title "YOUR TITLE HERE";

Back to top

Message box example 4:

#!/bin/bash

###############################################################################
# This script opens a KDialog window that is attached to the current window.  #
# The Kdialog window displays your single-line message box. The command       #
# always returns a 0 exit code.                                               #
###############################################################################

kdialog ${WINDOWID:+--attach $WINDOWID} --msgbox "YOUR MESSAGE HERE";

Back to top

Passive pop-up

Passive pop-up example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog passive pop-up window that displays a         #
# single-line message for a specified number of seconds. The command always #
# returns a 0 exit code.                                                    #
#############################################################################

kdialog --passivepopup "TEXT" 5;

Back to top

Passive pop-up example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog passive pop-up window that displays a         #
# two-line message (created by using an HTML 
tag) for a specified # # number of seconds. The command always returns a 0 exit code. # ############################################################################# kdialog --passivepopup "LINE1 LINE2" 5;

Back to top

Passive pop-up example 3:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog passive pop-up window that displays a  #
# single-line message for a specified number of seconds. The command always #
# returns a 0 exit code.                                                    #
#############################################################################

kdialog --title "EXAMPLE" --passivepopup "MESSAGE" 5;

Back to top

Password

Password example 1:
#!/bin/bash

###############################################################################
# This script opens a Kdialog password input window with a single-line        #
# message that asks you to enter your password. Command substitution is used  #
# to store your response, if any, in a variable. The script then tests the    #
# exit status of the command.                                                 #
#                                                                             #
# The command returns nothing and inserts a blank line into the terminal      #
# window if nothing is entered into the box and the OK button or the Enter    #
# key is pressed.                                                             #
#                                                                             #
# The command returns a 0 exit code if input is entered into the box and the  #
# OK button or the Enter key is pressed. It then executes the action you      #
# assigned to the if section. In this example it displays a KDialog message   #
# box with the contents of the variable (the password you typed in).          #
#                                                                             #
# The command returns a 1 exit code if the Cancel button or the Enter key is  #
# pressed. It then executes the action you assigned to the elif section. In   #
# this example it displays a KDialog sorry message.                           #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Password example 2:

#!/bin/bash

###############################################################################
# This script opens a Kdialog password input window with a single-line        #
# message that asks you to enter your password. Command substitution is used  #
# to store your response, if any, in a variable. The script then tests the    #
# exit status of the command.                                                 #
#                                                                             #
# The command returns nothing and inserts a blank line into the terminal      #
# window if nothing is entered into the box and the OK button or the Enter    #
# key is pressed.                                                             #
#                                                                             #
# The command returns a 0 exit code if input is entered into the box and the  #
# OK button or the Enter key is pressed. It then executes the action you      #
# assigned to the 0 pattern. In this example it displays a KDialog message    #
# box with the contents of the variable (the password you typed in).          #
#                                                                             #
# The command returns a 1 exit code if the Cancel button or the Enter key is  #
# pressed. It then executes the action you assigned to the 1 pattern. In this #
# example it displays a KDialog sorry message.                                #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# * pattern. In this example it displays a KDialog error message.             #
###############################################################################

variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Password example 3:

#!/bin/bash

###############################################################################
# This script opens a Kdialog password input window with a two-line message   #
# (created by using an HTML 
tag) message that asks you to enter your # # password. Command substitution is used to store your response, if any, in a # # variable. The script then tests the exit status of the command. # # # # The command returns nothing and inserts a blank line into the terminal # # window if nothing is entered into the box and the OK button or the Enter # # key is pressed. # # # # The command returns a 0 exit code if input is entered into the box and the # # OK button or the Enter key is pressed. It then executes the action you # # assigned to the if section. In this example it displays a KDialog message # # box with the contents of the variable (the password you typed in). # # # # The command returns a 1 exit code if the Cancel button or the Enter key is # # pressed. It then executes the action you assigned to the elif section. In # # this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################### variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD"); if [ "$?" = 0 ]; then kdialog --msgbox "$variable"; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Password example 4:

#!/bin/bash

###############################################################################
# This script opens a Kdialog password input window with a two-line message   #
# (created by using an HTML 
tag) message that asks you to enter your # # password. Command substitution is used to store your response, if any, in a # # variable. The script then tests the exit status of the command. # # # # The command returns nothing and inserts a blank line into the terminal # # window if nothing is entered into the box and the OK button or the Enter # # key is pressed. # # # # The command returns a 0 exit code if input is entered into the box and the # # OK button or the Enter key is pressed. It then executes the action you # # assigned to the 0 pattern. In this example it displays a KDialog message # # box with the contents of the variable (the password you typed in). # # # # The command returns a 1 exit code if the Cancel button or the Enter key is # # pressed. It then executes the action you assigned to the 1 pattern. In this # # example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################### variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD"); case "$?" in 0) kdialog --msgbox "$variable"; ;; 1) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Password example 5:

#!/bin/bash

###############################################################################
# This script opens a titled Kdialog password input window with a single-line #
# message that asks you to enter your password. Command substitution is used  #
# to store your response, if any, in a variable. The script then tests the    #
# exit status of the command.                                                 #
#                                                                             #
# The command returns nothing and inserts a blank line into the terminal      #
# window if nothing is entered into the box and the OK button or the Enter    #
# key is pressed.                                                             #
#                                                                             #
# The command returns a 0 exit code if input is entered into the box and the  #
# OK button or the Enter key is pressed. It then executes the action you      #
# assigned to the if section. In this example it displays a KDialog message   #
# box with the contents of the variable (the password you typed in).          #
#                                                                             #
# The command returns a 1 exit code if the Cancel button or the Enter key is  #
# pressed. It then executes the action you assigned to the elif section. In   #
# this example it displays a KDialog sorry message.                           #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD" --title "YOUR TITLE HERE");

if [ "$?" = 0 ]; then
	kdialog --msgbox "$variable";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Password example 6:

#!/bin/bash

###############################################################################
# This script opens a titled Kdialog password input window with a single-line #
# message that asks you to enter your password. Command substitution is used  #
# to store your response, if any, in a variable. The script then tests the    #
# exit status of the command.                                                 #
#                                                                             #
# The command returns nothing and inserts a blank line into the terminal      #
# window if nothing is entered into the box and the OK button or the Enter    #
# key is pressed.                                                             #
#                                                                             #
# The command returns a 0 exit code if input is entered into the box and the  #
# OK button or the Enter key is pressed. It then executes the action you      #
# assigned to the 0 pattern. In this example it displays a KDialog message    #
# box with the contents of the variable (the password you typed in).          #
#                                                                             #
# The command returns a 1 exit code if the Cancel button or the Enter key is  #
# pressed. It then executes the action you assigned to the 1 pattern. In this #
# example it displays a KDialog sorry message.                                #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# * pattern. In this example it displays a KDialog error message.             #
###############################################################################

variable=$(kdialog --password "PLEASE ENTER YOUR PASSWORD" --title "YOUR TITLE HERE");

case "$?" in
	0)
		kdialog --msgbox "$variable";
		;;
	1)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Progress bar

Progress bar example 1:
#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE" 4);
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 2:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # sleep command pauses the script for 1 second. # # # # The last line closes the progress bar window automatically when the # # progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE" 4); sleep 1; qdbus $progress Set "" value 1 > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; sleep 1; qdbus $progress close > /dev/null;

Back to top

Progress bar example 3:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE" 4);
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 4:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 5:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # sleep command pauses the script for 1 second. # # # # The last line closes the progress bar window automatically when the # # progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE"); qdbus $progress Set "" maximum 4 > /dev/null; sleep 1; qdbus $progress Set "" value 1 > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; sleep 1; qdbus $progress close > /dev/null;

Back to top

Progress bar example 6:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 7:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# window text is replaced with the specified label text provided by a qdbus  #
# statement, and the sleep command pauses the script for 1 second.           #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE" 4);
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 8:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # window text is replaced with the specified label text provided by a qdbus # # statement, and the sleep command pauses the script for 1 second. # # # # The last line closes the progress bar window automatically when the # # progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE" 4); sleep 1; qdbus $progress Set "" value 1 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null; sleep 1; qdbus $progress close > /dev/null;

Back to top

Progress bar example 9:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# window text is replaced with the specified label text provided by a qdbus  #
# statement, and the sleep command pauses the script for 1 second.           #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE" 4);
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 10:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# window text is replaced with the specified label text provided by a qdbus  #
# statement, and the sleep command pauses the script for 1 second.           #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 11:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # window text is replaced with the specified label text provided by a qdbus # # statement, and the sleep command pauses the script for 1 second. # # # # The last line closes the progress bar window automatically when the # # progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE"); qdbus $progress Set "" maximum 4 > /dev/null; sleep 1; qdbus $progress Set "" value 1 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null; sleep 1; qdbus $progress close > /dev/null;

Back to top

Progress bar example 12:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# window text is replaced with the specified label text provided by a qdbus  #
# statement, and the sleep command pauses the script for 1 second.           #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 13:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# A qdbus autoClose statement closes the progress bar window automatically   #
# when the progress bar is full.                                             #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE" 4);
qdbus $progress Set "" autoClose true > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;

Back to top

Progress bar example 14:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # sleep command pauses the script for 1 second. # # # # A qdbus autoClose statement closes the progress bar window automatically # # when the progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE" 4); qdbus $progress Set "" autoClose true > /dev/null; sleep 1; qdbus $progress Set "" value 1 > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; sleep 1;

Back to top

Progress bar example 15:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# A qdbus autoClose statement closes the progress bar window automatically   #
# when the progress bar is full.                                             #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE" 4);
qdbus $progress Set "" autoClose true > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;

Back to top

Progress bar example 16:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# A qdbus autoClose statement closes the progress bar window automatically   #
# when the progress bar is full.                                             #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" autoClose true > /dev/null;
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;

Back to top

Progress bar example 17:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a two-line message (created by     #
# using an HTML 
tag) and a progress bar that moves in increments until # # the bar is full, and then closes. The command always returns a 0 exit # # code. # # # # In this example 4 increments have been defined in a qdbus (a # # communication-interface for qt-based applications) statement, with each # # increment controlled by qdbus to increase the progress bar by the amount # # corresponding to the number of increments that have been defined. # # # # An action you define is taken between each increment. In this example, the # # sleep command pauses the script for 1 second. # # # # A qdbus autoClose statement closes the progress bar window automatically # # when the progress bar is full. # # # # The use of > /dev/null redirects the qdbus output to the /dev/null device # # file to dispose of it so it won't insert an empty line into your terminal # # window, which is its default behavior. # ############################################################################## progress=$(kdialog --progressbar "YOUR TEXT HERE"); qdbus $progress Set "" autoClose true > /dev/null; qdbus $progress Set "" maximum 4 > /dev/null; sleep 1; qdbus $progress Set "" value 1 > /dev/null; sleep 1; qdbus $progress Set "" value 2 > /dev/null; sleep 1; qdbus $progress Set "" value 3 > /dev/null; sleep 1; qdbus $progress Set "" value 4 > /dev/null; sleep 1;

Back to top

Progress bar example 18:

#!/bin/bash

##############################################################################
# This script opens a titled KDialog window with a single-line message and a #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# A qdbus autoClose statement closes the progress bar window automatically   #
# when the progress bar is full.                                             #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --title "YOUR TITLE HERE" --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" autoClose true > /dev/null;
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;

Back to top

Progress bar example 19:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# window text is replaced with the specified label text provided by a qdbus  #
# statement, a KDialog message window is displayed, and the sleep command    #
# pauses the script for 1 second.                                            #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE");
qdbus $progress Set "" maximum 4 > /dev/null;
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 1 TEXT HERE" > /dev/null;
kdialog --msgbox "STEP 1";
sleep 1;
qdbus $progress Set "" value 2 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 2 TEXT HERE" > /dev/null;
kdialog --msgbox "STEP 2";
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 3 TEXT HERE" > /dev/null;
kdialog --msgbox "STEP 3";
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
qdbus $progress setLabelText "YOUR VALUE 4 TEXT HERE" > /dev/null;
kdialog --msgbox "STEP 4";
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Progress bar example 20:

#!/bin/bash

##############################################################################
# This script opens a KDialog window with a single-line message and a        #
# progress bar that moves in increments until the bar is full, and then      #
# closes. The command always returns a 0 exit code.                          #
#                                                                            #
# In this example 4 increments have been defined in a qdbus  (a              #
# communication-interface for qt-based applications) statement, with each    #
# increment controlled by qdbus to increase the progress bar by the amount   #
# corresponding to the number of increments that have been defined.          #
#                                                                            #
# An action you define is taken between each increment. In this example, the #
# sleep command pauses the script for 1 second.                              #
#                                                                            #
# The progress bar display skips past the second increment because it has    #
# been commented out (this can be useful if you wish your progress bar to    #
# jump to a specified increment).                                            #
#                                                                            #
# The last line closes the progress bar window automatically when the        #
# progress bar is full.                                                      #
#                                                                            #
# The use of > /dev/null redirects the qdbus output to the /dev/null device  #
# file to dispose of it so it won't insert an empty line into your terminal  #
# window, which is its default behavior.                                     #
##############################################################################

progress=$(kdialog --progressbar "YOUR TEXT HERE" 4);
sleep 1;
qdbus $progress Set "" value 1 > /dev/null;
sleep 1;
#qdbus $progress Set "" value 2 > /dev/null;
sleep 1;
qdbus $progress Set "" value 3 > /dev/null;
sleep 1;
qdbus $progress Set "" value 4 > /dev/null;
sleep 1;
qdbus $progress close > /dev/null;

Back to top

Radio list

Radio list example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a radio list from which to make a choice. Command substitution is     #
# used to save your choice to a variable. The script then tests the exit    #
# status of the command.                                                    #
#                                                                           #
# The KDialog command returns a 0 exit code if the OK button or Enter key   #
# is pressed. In that case, the script executes the action you assigned to  #
# the if section. In this example it displays a KDialog message box that    #
# corresponds to the value (key or, in this example, option number) you     #
# chose in the nested if or nested elif sections. In this example, each     #
# choice displays a custom KDialog message box. The RED label has a value   #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a      #
# value of 3 and only one of them can be chosen. If anything else happens,  #
# the script executes the action you assigned to the nested else section.   #
# In this example it displays a KDialog error message.                      #
#                                                                           #
# The KDialog command returns a 1 exit code if the CANCEL button is pressed #
# or is highlighted while the Enter key is pressed. In that case, the       #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

variable=$(kdialog --radiolist "CHOOSE A COLOR:" 1 "RED" on 2 "YELLOW" on 3 GREEN" off;);

if [ "$?" = 0 ]; then
	if [ "$variable" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$variable" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$variable" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Radio list example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) that offers you a radio list from which to make a # # choice. Command substitution is used to save your choice to a variable. # # The script then tests the exit status of the command. # # # # The KDialog command returns a 0 exit code if the OK button or Enter key # # is pressed. In that case, the script executes the action you assigned to # # the if section. In this example it displays a KDialog message box that # # corresponds to the value (key or, in this example, option number) you # # chose in the nested if or nested elif sections. In this example, each # # choice displays a custom KDialog message box. The RED label has a value # # of 1 and the YELLOW label has a value of 2 and the GREEN label has a # # value of 3 and only one of them can be chosen. If anything else happens, # # the script executes the action you assigned to the nested else section. # # In this example it displays a KDialog error message. # # # # The KDialog command returns a 1 exit code if the CANCEL button is pressed # # or is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the elif section. In this # # example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################# variable=$(kdialog --radiolist "CHOOSE A COLOR:" 1 "RED" on 2 "YELLOW" on 3 "GREEN" off;); if [ "$?" = 0 ]; then if [ "$variable" = 1 ]; then kdialog --msgbox "YOU CHOSE RED"; elif [ "$variable" = 2 ]; then kdialog --msgbox "YOU CHOSE YELLOW"; elif [ "$variable" = 3 ]; then kdialog --msgbox "YOU CHOSE GREEN"; else kdialog --error "ERROR"; fi; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Radio list example 3:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a radio list from which to make a choice. Command substitution #
# is used to save your choice to a variable. The script then tests the exit #
# status of the command.                                                    #
#                                                                           #
# The KDialog command returns a 0 exit code if the OK button or Enter key   #
# is pressed. In that case, the script executes the action you assigned to  #
# the if section. In this example it displays a KDialog message box that    #
# corresponds to the value (key or, in this example, option number) you     #
# chose in the nested if or nested elif sections. In this example, each     #
# choice displays a custom KDialog message box. The RED label has a value   #
# of 1 and the YELLOW label has a value of 2 and the GREEN label has a      #
# value of 3 and only one of them can be chosen. If anything else happens,  #
# the script executes the action you assigned to the nested else section.   #
# In this example it displays a KDialog error message.                      #
#                                                                           #
# The KDialog command returns a 1 exit code if the CANCEL button is pressed #
# or is highlighted while the Enter key is pressed. In that case, the       #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

variable=$(kdialog --radiolist "CHOOSE A COLOR:" 1 "RED" on  2  "YELLOW" on 3 "GREEN" off --title "YOUR TITLE HERE";);

if [ "$?" = 0 ]; then
	if [ "$variable" = 1 ]; then
		kdialog --msgbox "YOU CHOSE RED";
	elif [ "$variable" = 2 ]; then
		kdialog --msgbox "YOU CHOSE YELLOW";
	elif [ "$variable" = 3 ]; then
		kdialog --msgbox "YOU CHOSE GREEN";
	else
		kdialog --error "ERROR";
	fi;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Slider

Slider example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a slider you can move to any position along its line. Clicking on the #
# slider moves the slider to the increment position closest to your mouse.  #
# The slider can be positioned between increments by being dragged. When    #
# the OK button or the Enter key are pressed, command substitution is used  #
# to save the slider position to a variable. The script then tests the exit #
# status of the command.                                                    #
#                                                                           #
# In this example the minimum value of the slider is 0, the maximum value   #
# of the slider is 20, and there are 3 increments.                          #
#                                                                           #
# The KDialog command returns a 1 exit code if the OK button or the Enter   #
# key is pressed while the OK button is highlighted. In that case, the      #
# script executes the action you assigned to the if section. In this        #
# example it displays a KDialog message window letting you know the value   #
# that corresponds to the position of the slider.                           #
#                                                                           #
# The KDialog command returns a 0 exit code if the CANCEL button is pressed #
# or is highlighted while the Enter key is pressed. I have not managed to   #
# successfully write any code that parses the 0 exit code and assigns it to #
# an action, but I'm mentioning the exit code here in case you want to try. #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog sorry message.    #
#############################################################################

result=$(kdialog --slider "TEXT" 0 20 3);

if [ "$?" = 1 ]; then
	kdialog --msgbox "$result";
else
	kdialog --sorry "YOU CHOSE CANCEL";
fi;

Back to top

Sorry

Sorry example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your single-line sorry     #
# message. The command always returns a 0 exit code.                          #
###############################################################################

kdialog --sorry "YOUR MESSAGE HERE";

Back to top

Sorry example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog window that displays your two-line message      #
# (created by using an HTML 
tag). The command always returns a 0 exit # # code. # ############################################################################### kdialog --sorry "YOUR MESSAGE HERE";

Back to top

Sorry example 3:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog window that displays your single-line    #
# sorry message. The command always returns a 0 exit code.                    #
###############################################################################

kdialog --title "EXAMPLE" --sorry "YOUR MESSAGE HERE";

Back to top

Text box

Text box example 1:
#!/bin/bash

###############################################################################
# This script opens a KDialog text box window that displays the contents of   #
# the specified file (in this example it displays the FILENAME file) and an   #
# OK button. The script then tests the exit status of the command.            #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# if section. In this example it displays a KDialog message box letting you   #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the elif section. #
# In this example it displays a KDialog sorry message letting you know you    #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

kdialog --textbox FILENAME;

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU PRESSED OK";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CLOSED THE WINDOW";
else
	kdialog --error "ERROR";
fi;

Back to top

Text box example 2:

#!/bin/bash

###############################################################################
# This script opens a KDialog text box window that displays the contents of   #
# the specified file (in this example it displays the FILENAME file) and an   #
# OK button. The script then tests the exit status of the command.            #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# 0 pattern. In this example it displays a KDialog message box letting you    #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the 1 pattern. In #
# this example it displays a KDialog sorry message letting you know you       #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

kdialog --textbox FILENAME;

case "$?" in
	0)
		kdialog --msgbox "YOU PRESSED OK";
		;;
	1)
		kdialog --sorry "YOU CLOSED THE WINDOW";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Text box example 3:

#!/bin/bash

###############################################################################
# This script opens a Kdialog text box window of the size specified in pixels #
# (in this example it's 400 x 300) that displays the contents of the          #
# specified file (in this example it displays the FILENAME file) and an OK    #
# button. The script then tests the exit status of the command.               #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# if section. In this example it displays a KDialog message box letting you   #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the elif section. #
# In this example it displays a KDialog sorry message letting you know you    #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

kdialog --textbox FILENAME 400 300;

if [ "$?" = 0 ]; then
	:;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CLOSED THE WINDOW";
else
	kdialog --error "ERROR";
fi;

Back to top

Text box example 4:

#!/bin/bash

###############################################################################
# This script opens a Kdialog text box window of the size specified in pixels #
# (in this example it's 400 x 300) that displays the contents of the          #
# specified file (in this example it displays the FILENAME file) and an OK    #
# button. The script then tests the exit status of the command.               #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# 0 pattern. In this example it displays a KDialog message box letting you    #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the 1 pattern. In #
# this example it displays a KDialog sorry message letting you know you       #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

kdialog --textbox FILENAME 400 300;

case "$?" in
	0)
		kdialog --msgbox "YOU PRESSED OK";
		;;
	1)
		kdialog --sorry "YOU CLOSED THE WINDOW";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Text box example 5:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog text box window that displays the        #
# contents of the specified file (in this example it displays the FILENAME    #
# file) and an OK button. The script then tests the exit status of the        #
# command.                                                                    #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# if section. In this example it displays a KDialog message box letting you   #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the elif section. #
# In this example it displays a KDialog sorry message letting you know you    #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

kdialog --textbox FILENAME --title "YOUR TITLE HERE";

if [ "$?" = 0 ]; then
	:;
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CLOSED THE WINDOW";
else
	kdialog --error "ERROR";
fi;

Back to top

Text box example 6:

#!/bin/bash

###############################################################################
# This script opens a titled KDialog text box window that displays the        #
# contents of the specified file (in this example it displays the FILENAME    #
# file) and an OK button. The script then tests the exit status of the        #
# command.                                                                    #
#                                                                             #
# The kdialog command returns a 0 exit code if the Enter key or OK button is  #
# pressed. In that case, the script executes the action you assigned to the   #
# 0 pattern. In this example it displays a KDialog message box letting you    #
# know you pressed OK.                                                        #
#                                                                             #
# The kdialog command returns a 1 exit code if the Esc key is pressed. In     #
# that case, the script executes the action you assigned to the 1 pattern. In #
# this example it displays a KDialog sorry message letting you know you       #
# closed the window.                                                          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

kdialog --textbox FILENAME --title "YOUR TITLE HERE";

case "$?" in
	0)
		kdialog --msgbox "YOU PRESSED OK";
		;;
	1)
		kdialog --sorry "YOU CLOSED THE WINDOW";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Warning continue cancel

Warning continue cancel example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Continue and Cancel. The script then tests the exit  #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Continue button or the   #
# Enter key is pressed. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns 2 if the CANCEL button is pressed or if it is #
# highlighted while the Enter key is pressed. In that case, the script      #
# executes the action you assigned to the else section. In this example it  #
# displays a KDialog sorry message.                                         #
#############################################################################

kdialog --warningcontinuecancel "PLEASE CHOOSE";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE CONTINUE";
else
	kdialog --sorry "YOU CHOSE CANCEL";
fi;

Back to top

Warning continue cancel example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Continue and Cancel. The script then tests the exit  #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Continue button or the   #
# Enter key is pressed. In that case, the script executes the action you    #
# assigned to the 0 pattern. In this example it displays a KDialog message  #
# box.                                                                      #
#                                                                           #
# The kdialog command returns 2 if the CANCEL button is pressed or if it is #
# highlighted while the Enter key is pressed. In that case, the script      #
# executes the action you assigned to the * pattern. In this example it     #
# displays a KDialog sorry message.                                         #
#############################################################################

kdialog --warningcontinuecancel "PLEASE CHOOSE";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE CONTINUE";
		;;
	*)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
esac;

Back to top

Warning continue cancel example 3:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) with a single-line message that offers you a # # choice between Continue and Cancel. The script then tests the exit status # # of the command. # # # # The kdialog command returns a 0 exit code if the Continue button or the # # Enter key is pressed. In that case, the script executes the action you # # assigned to the if section. In this example it displays a KDialog message # # box. # # # # The kdialog command returns 2 if the CANCEL button is pressed or if it is # # highlighted while the Enter key is pressed. In that case, the script # # executes the action you assigned to the else section. In this example it # # displays a KDialog sorry message. # ############################################################################# kdialog --warningcontinuecancel "PLEASE CHOOSE"; if [ "$?" = 0 ]; then kdialog --msgbox "YOU CHOSE CONTINUE"; else kdialog --sorry "YOU CHOSE CANCEL"; fi;

Back to top

Warning continue cancel example 4:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) with a single-line message that offers you a # # choice between Continue and Cancel. The script then tests the exit status # # of the command. # # # # The kdialog command returns a 0 exit code if the Continue button or the # # Enter key is pressed. In that case, the script executes the action you # # assigned to the 0 pattern. In this example it displays a KDialog message # # box. # # # # The kdialog command returns 2 if the CANCEL button is pressed or if it is # # highlighted while the Enter key is pressed. In that case, the script # # executes the action you assigned to the * pattern. In this example it # # displays a KDialog sorry message. # ############################################################################# kdialog --warningcontinuecancel "PLEASE CHOOSE"; case "$?" in 0) kdialog --msgbox "YOU CHOSE CONTINUE"; ;; *) kdialog --sorry "YOU CHOSE CANCEL"; ;; esac;

Back to top

Warning continue cancel example 5:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Continue and Cancel. The script then tests    #
# the exit status of the command.                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Continue button or the   #
# Enter key is pressed. In that case, the script executes the action you    #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns 2 if the CANCEL button is pressed or if it is #
# highlighted while the Enter key is pressed. In that case, the script      #
# executes the action you assigned to the else section. In this example it  #
# displays a KDialog sorry message.                                         #
#############################################################################

kdialog --warningcontinuecancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE CONTINUE";
else
	kdialog --sorry "YOU CHOSE CANCEL";
fi;

Back to top

Warning continue cancel example 6:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Continue and Cancel. The script then tests    #
# the exit status of the command.                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Continue button or the   #
# Enter key is pressed. In that case, the script executes the action you    #
# assigned to the 0 pattern. In this example it displays a KDialog message  #
# box.                                                                      #
#                                                                           #
# The kdialog command returns 2 if the CANCEL button is pressed or if it is #
# highlighted while the Enter key is pressed. In that case, the script      #
# executes the action you assigned to the * pattern. In this example it     #
# displays a KDialog sorry message.                                         #
#############################################################################

kdialog --warningcontinuecancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE CONTINUE";
		;;
	*)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
esac;

Back to top

Warning yes no

Warning yes no example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Yes and No. The script then tests the exit status of #
# the command.                                                              #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  # 
# key is pressed. In that case, the script executes the action you assigned #
# to the if section. In this example it displays a KDialog message box.     #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

kdialog --warningyesno "PLEASE CHOOSE:";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE NO";
else
	kdialog --error "ERROR";
fi;

Back to top

Warning yes no example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Yes and No. The script then tests the exit status of #
# the command.                                                              #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the 0 pattern. In this example it displays a KDialog message box.      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the 1 pattern. In this example #
# it displays a KDialog sorry message.                                      #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the * pattern. In this example it displays a KDialog error message.       #
#############################################################################

kdialog --warningyesno "PLEASE CHOOSE:";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --sorry "YOU CHOSE NO";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Warning yes no example 3:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) that offers you a choice between Yes and No. The # # script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Yes button or the Enter # # key is pressed. In that case, the script executes the action you assigned # # to the if section. In this example it displays a KDialog message box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the elif section. In this # # example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################# kdialog --warningyesno "PLEASE CHOOSE:"; if [ "$?" = 0 ]; then kdialog --msgbox "YOU CHOSE YES"; elif [ "$?" = 1 ]; then kdialog --sorry "YOU CHOSE NO"; else kdialog --error "ERROR"; fi;

Back to top

Warning yes no example 4:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) that offers you a choice between Yes and No. The # # script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Yes button or the Enter # # key is pressed. In that case, the script executes the action you assigned # # to the 0 pattern. In this example it displays a KDialog message box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the 1 pattern. In this example # # it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################# kdialog --warningyesno "PLEASE CHOOSE:"; case "$?" in 0) kdialog --msgbox "YOU CHOSE YES"; ;; 1) kdialog --sorry "YOU CHOSE NO"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Warning yes no example 5:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Yes and No. The script then tests the exit    #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the if section. In this example it displays a KDialog message box.     #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

kdialog --warningyesno "PLEASE CHOOSE:" --title "YOUR TITLE HERE";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$?" = 1 ]; then
	kdialog --sorry "YOU CHOSE NO";
else
	kdialog --error "ERROR";
fi;

Back to top

Warning yes no example 6:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Yes and No. The script then tests the exit    #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the 0 pattern. In this example it displays a KDialog message box.      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the 1 pattern. In this example #
# it displays a KDialog sorry message.                                      #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the * pattern. In this example it displays a KDialog error message.       #
#############################################################################

kdialog --warningyesno "PLEASE CHOOSE:" --title "YOUR TITLE HERE";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --sorry "YOU CHOSE NO";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Warning yes no cancel

Warning yes no cancel example 1:
#!/bin/bash

###############################################################################
# This script opens a Kdialog window with a single-line message that offers   #
# you a choice between Yes or No or cancel. Command substitution is used to   #
# save your choice (the exit status of the command) to a variable. The script #
# then tests the value of the variable.                                       #
#                                                                             #
# The command returns a 0 exit code if the Enter key is pressed without       #
# making a selection, if the Yes button is pressed, or if the Yes button is   #
# selected and the Enter key is pressed. The script then executes the command #
# you assigned to the if section. In this example it displays a KDialog       #
# messaege box.                                                               #
#                                                                             #
# The command returns a 1 exit code if the No button is pressed, or if the No #
# button is selected and the Enter key is pressed. The script then executes   #
# the command you assigned to the first elif section. In this example it      #
# displays a KDialog message box.                                             #
#                                                                             #
# The command returns a 2 exit code if the Cancel button or the Esc key is    #
# pressed. The script then executes the command you assigned to the second    #
# elif section. In this example it displays a KDialog sorry message.          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

kdialog --warningyesnocancel "PLEASE CHOOSE";
answer=$(echo "$?");

if [ "$answer" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$answer" = 1 ]; then
	kdialog --msgbox "YOU CHOSE NO";
elif [ "$answer" = 2 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Warning yes no cancel example 2:

#!/bin/bash

###############################################################################
# This script opens a Kdialog window with a single-line message that offers   #
# you a choice between Yes or No or cancel. Command substitution is used to   #
# save your choice (the exit status of the command) to a variable. The script #
# then tests the value of the variable.                                       #
#                                                                             #
# The command returns a 0 exit code if the Enter key is pressed without       #
# making a selection, if the Yes button is pressed, or if the Yes button is   #
# selected and the Enter key is pressed. The script then executes the command #
# you assigned to the 0 pattern. In this example it displays a KDialog        #
# messaege box.                                                               #
#                                                                             #
# The command returns a 1 exit code if the No button is pressed, or if the No #
# button is selected and the Enter key is pressed. The script then executes   #
# the command you assigned to the 1 pattern. In this example it displays a    #
# KDialog message box.                                                        #
#                                                                             #
# The command returns a 2 exit code if the Cancel button or the Esc key is    #
# pressed. The script then executes the command you assigned to the 2         #
# pattern.. In this example it displays a KDialog sorry message.              #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

kdialog --warningyesnocancel "PLEASE CHOOSE";
answer=$(echo "$?");

case "$answer" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --msgbox "YOU CHOSE NO";
		;;
	2)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Warning yes no cancel example 3:

#!/bin/bash

###############################################################################
# This script opens a Kdialog window with a two-line message (created by      #
# using an HTML 
tag) with a single-line message that offers you a choice # # between Yes or No or cancel. Command substitution is used to save your # # choice (the exit status of the command) to a variable. The script then # # tests the value of the variable. # # # # The command returns a 0 exit code if the Enter key is pressed without # # making a selection, if the Yes button is pressed, or if the Yes button is # # selected and the Enter key is pressed. The script then executes the command # # you assigned to the if section. In this example it displays a KDialog # # messaege box. # # # # The command returns a 1 exit code if the No button is pressed, or if the No # # button is selected and the Enter key is pressed. The script then executes # # the command you assigned to the first elif section. In this example it # # displays a KDialog message box. # # # # The command returns a 2 exit code if the Cancel button or the Esc key is # # pressed. The script then executes the command you assigned to the second # # elif section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################### kdialog --warningyesnocancel "PLEASE CHOOSE"; answer=$(echo "$?"); if [ "$answer" = 0 ]; then kdialog --msgbox "YOU CHOSE YES"; elif [ "$answer" = 1 ]; then kdialog --msgbox "YOU CHOSE NO"; elif [ "$answer" = 2 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Warning yes no cancel example 4:

#!/bin/bash

###############################################################################
# This script opens a Kdialog window with a two-line message (created by      #
# using an HTML 
tag) with a single-line message that offers you a choice # # between Yes or No or cancel. Command substitution is used to save your # # choice (the exit status of the command) to a variable. The script then # # tests the value of the variable. # # # # The command returns a 0 exit code if the Enter key is pressed without # # making a selection, if the Yes button is pressed, or if the Yes button is # # selected and the Enter key is pressed. The script then executes the command # # you assigned to the 0 pattern. In this example it displays a KDialog # # messaege box. # # # # The command returns a 1 exit code if the No button is pressed, or if the No # # button is selected and the Enter key is pressed. The script then executes # # the command you assigned to the 1 pattern. In this example it displays a # # KDialog message box. # # # # The command returns a 2 exit code if the Cancel button or the Esc key is # # pressed. The script then executes the command you assigned to the 2 # # pattern.. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################### kdialog --warningyesnocancel "PLEASE CHOOSE"; answer=$(echo "$?"); case "$answer" in 0) kdialog --msgbox "YOU CHOSE YES"; ;; 1) kdialog --msgbox "YOU CHOSE NO"; ;; 2) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Warning yes no cancel example 5:

#!/bin/bash

###############################################################################
# This script opens a titled Kdialog window with a single-line message that   #
# offers you a choice between Yes or No or cancel. Command substitution is    #
# used to save your choice (the exit status of the command) to a variable.    #
# The script then tests the value of the variable.                            #
#                                                                             #
# The command returns a 0 exit code if the Enter key is pressed without       #
# making a selection, if the Yes button is pressed, or if the Yes button is   #
# selected and the Enter key is pressed. The script then executes the command #
# you assigned to the if section. In this example it displays a KDialog       #
# messaege box.                                                               #
#                                                                             #
# The command returns a 1 exit code if the No button is pressed, or if the No #
# button is selected and the Enter key is pressed. The script then executes   #
# the command you assigned to the first elif section. In this example it      #
# displays a KDialog message box.                                             #
#                                                                             #
# The command returns a 2 exit code if the Cancel button or the Esc key is    #
# pressed. The script then executes the command you assigned to the second    #
# elif section. In this example it displays a KDialog sorry message.          #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the else section. In this example it displays a KDialog error message.      #
###############################################################################

kdialog --warningyesnocancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";
answer=$(echo "$?");

if [ "$answer" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$answer" = 1 ]; then
	kdialog --msgbox "YOU CHOSE NO";
elif [ "$answer" = 2 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Warning yes no cancel example 6:

#!/bin/bash

###############################################################################
# This script opens a titled Kdialog window with a single-line message that   #
# offers you a choice between Yes or No or cancel. Command substitution is    #
# used to save your choice (the exit status of the command) to a variable.    #
# The script then tests the value of the variable.                            #
#                                                                             #
# The command returns a 0 exit code if the Enter key is pressed without       #
# making a selection, if the Yes button is pressed, or if the Yes button is   #
# selected and the Enter key is pressed. The script then executes the command #
# you assigned to the 0 pattern. In this example it displays a KDialog        #
# messaege box.                                                               #
#                                                                             #
# The command returns a 1 exit code if the No button is pressed, or if the No #
# button is selected and the Enter key is pressed. The script then executes   #
# the command you assigned to the 1 pattern. In this example it displays a    #
# KDialog message box.                                                        #
#                                                                             #
# The command returns a 2 exit code if the Cancel button or the Esc key is    #
# pressed. The script then executes the command you assigned to the 2         #
# pattern.. In this example it displays a KDialog sorry message.              #
#                                                                             #
# If anything else happens, the script executes the action you assigned to    #
# the * pattern. In this example it displays a KDialog error message.         #
###############################################################################

kdialog --warningyesnocancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";
answer=$(echo "$?");

case "$answer" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --msgbox "YOU CHOSE NO";
		;;
	2)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Yes no

Yes no example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Yes and No. The script then tests the exit status of #
# the command.                                                              #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the if section. In this example it displays a KDialog message box.     #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

kdialog --yesno "PLEASE CHOOSE";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$?" = 1 ]; 	then
	kdialog --sorry "YOU CHOSE NO";
else
	kdialog --error "ERROR";
fi;

Back to top

Yes no example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a single-line message that offers #
# you a choice between Yes and No. The script then tests the exit status of #
# the command.                                                              #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the 0 pattern. In this example it displays a KDialog message box.      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the 1 pattern. In this example #
# it displays a KDialog sorry message.                                      #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the * pattern. In this example it displays a KDialog error message.       #
#############################################################################

kdialog --yesno "PLEASE CHOOSE";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --sorry "YOU CHOSE NO";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Yes no example 3:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) that offers you a choice between Yes and No. The # # script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Yes button or the Enter # # key is pressed. In that case, the script executes the action you assigned # # to the if section. In this example it displays a KDialog message box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the elif section. In this # # example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################# kdialog --yesno "PLEASE CHOOSE"; if [ "$?" = 0 ]; then kdialog --msgbox "YOU CHOSE YES"; elif [ "$?" = 1 ]; then kdialog --msgbox "YOU CHOSE NO"; else kdialog --error "ERROR"; fi;

Back to top

Yes no example 4:

#!/bin/bash

#############################################################################
# This script opens a KDialog window with a two-line message (created by    #
# using an HTML 
tag) that offers you a choice between Yes and No. The # # script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Yes button or the Enter # # key is pressed. In that case, the script executes the action you assigned # # to the 0 pattern. In this example it displays a KDialog message box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the 1 pattern. In this example # # it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the * pattern. In this example it displays a KDialog error message. # ############################################################################# kdialog --yesno "PLEASE CHOOSE"; case "$?" in 0) kdialog --msgbox "YOU CHOSE YES"; ;; 1) kdialog --sorry "YOU CHOSE NO"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Yes no example 5:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Yes and No. The script then tests the exit    #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the if section. In this example it displays a KDialog message box.     #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the elif section. In this      #
# example it displays a KDialog sorry message.                              #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the else section. In this example it displays a KDialog error message.    #
#############################################################################

kdialog --yesno "PLEASE CHOOSE" --title "YOUR TITLE HERE";

if [ "$?" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$?" = 1 ]; 	then
	kdialog --sorry "YOU CHOSE NO";
else
	kdialog --error "ERROR";
fi;

Back to top

Yes no example 6:

#!/bin/bash

#############################################################################
# This script opens a titled KDialog window with a single-line message that #
# offers you a choice between Yes and No. The script then tests the exit    #
# status of the command.                                                    #
#                                                                           #
# The kdialog command returns a 0 exit code if the Yes button or the Enter  #
# key is pressed. In that case, the script executes the action you assigned #
# to the 0 pattern. In this example it displays a KDialog message box.      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the 1 pattern. In this example #
# it displays a KDialog sorry message.                                      #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
# the * pattern. In this example it displays a KDialog error message.       #
#############################################################################

kdialog --yesno "PLEASE CHOOSE" --title "YOUR TITLE HERE";

case "$?" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --sorry "YOU CHOSE NO";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Yes no cancel

Yes no cancel example 1:
#!/bin/bash

#############################################################################
# This script opens a KDialog window that displays a single-line message    #
# that asks you to choose yes, no, or cancel. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status  #
# of the command.                                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Enter key or the Yes     #
# button is pressed. In that case, the script executes the action you       #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the first elif section. In     #
# this example it displays a KDialog message box.                           #
#                                                                           #
# The kdialog command returns a 2 exit code if the Esc key or Cancel button #
# is pressed. In that case, the menu executes the action in the second elif #
# section. In this example it displays a KDialog sorry message.             #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
#  the else section. In this example it displays a KDialog error message.   #
#############################################################################

kdialog --yesnocancel "PLEASE CHOOSE:";
answer="$?";

if [ "$answer" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$answer" = 1 ]; then
	kdialog --msgbox "YOU CHOSE NO";
elif [ "$answer" = 2 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Yes no cancel example 2:

#!/bin/bash

#############################################################################
# This script opens a KDialog window that displays a single-line message    #
# that asks you to choose yes, no, or cancel. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status  #
# of the command.                                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Enter key or the Yes     #
# button is pressed. In that case, the script executes the action you       #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the first elif section. In     #
# this example it displays a KDialog message box.                           #
#                                                                           #
# The kdialog command returns a 2 exit code if the Esc key or Cancel button #
# is pressed. In that case, the menu executes the action in the second elif #
# section. In this example it displays a KDialog sorry message.             #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
#  the else section. In this example it displays a KDialog error message.   #
#############################################################################

kdialog --yesnocancel "PLEASE CHOOSE:";
answer="$?";

case "$answer" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --msgbox "YOU CHOSE NO";
		;;
	2)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Yes no cancel example 3:

#!/bin/bash

#############################################################################
# This script opens a Kdialog window that displays a two-line message       #
# (created by using an HTML 
tag) that asks you to choose yes, # # no, or cancel. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Enter key or the Yes # # button is pressed. In that case, the script executes the action you # # assigned to the if section. In this example it displays a KDialog message # # box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the first elif section. In # # this example it displays a KDialog message box. # # # # The kdialog command returns a 2 exit code if the Esc key or Cancel button # # is pressed. In that case, the menu executes the action in the second elif # # section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################# kdialog --yesnocancel "PLEASE CHOOSE"; answer="$?"; if [ "$answer" = 0 ]; then kdialog --msgbox "YOU CHOSE YES"; elif [ "$answer" = 1 ]; then kdialog --msgbox "YOU CHOSE NO"; elif [ "$answer" = 2 ]; then kdialog --sorry "YOU CHOSE CANCEL"; else kdialog --error "ERROR"; fi;

Back to top

Yes no cancel example 4:

#!/bin/bash

#############################################################################
# This script opens a Kdialog window that displays a two-line message       #
# (created by using an HTML 
tag) that asks you to choose yes, # # no, or cancel. Command substitution is used to save your choice to a # # variable. The script then tests the exit status of the command. # # # # The kdialog command returns a 0 exit code if the Enter key or the Yes # # button is pressed. In that case, the script executes the action you # # assigned to the if section. In this example it displays a KDialog message # # box. # # # # The kdialog command returns a 1 exit code if the No button is pressed or # # if it is highlighted while the Enter key is pressed. In that case, the # # script executes the action you assigned to the first elif section. In # # this example it displays a KDialog message box. # # # # The kdialog command returns a 2 exit code if the Esc key or Cancel button # # is pressed. In that case, the menu executes the action in the second elif # # section. In this example it displays a KDialog sorry message. # # # # If anything else happens, the script executes the action you assigned to # # the else section. In this example it displays a KDialog error message. # ############################################################################# kdialog --yesnocancel "PLEASE CHOOSE"; answer="$?"; case "$answer" in 0) kdialog --msgbox "YOU CHOSE YES"; ;; 1) kdialog --msgbox "YOU CHOSE NO"; ;; 2) kdialog --sorry "YOU CHOSE CANCEL"; ;; *) kdialog --error "ERROR"; ;; esac;

Back to top

Yes no cancel example 5:

#!/bin/bash

#############################################################################
# This script opens a KDialog window that displays a single-line message    #
# that asks you to choose yes, no, or cancel. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status  #
# of the command.                                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Enter key or the Yes     #
# button is pressed. In that case, the script executes the action you       #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the first elif section. In     #
# this example it displays a KDialog message box.                           #
#                                                                           #
# The kdialog command returns a 2 exit code if the Esc key or Cancel button #
# is pressed. In that case, the menu executes the action in the second elif #
# section. In this example it displays a KDialog sorry message.             #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
#  the else section. In this example it displays a KDialog error message.   #
#############################################################################

kdialog --yesnocancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";
answer="$?";

if [ "$answer" = 0 ]; then
	kdialog --msgbox "YOU CHOSE YES";
elif [ "$answer" = 1 ]; then
	kdialog --msgbox "YOU CHOSE NO";
elif [ "$answer" = 2 ]; then
	kdialog --sorry "YOU CHOSE CANCEL";
else
	kdialog --error "ERROR";
fi;

Back to top

Yes no cancel example 6:

#!/bin/bash

#############################################################################
# This script opens a KDialog window that displays a single-line message    #
# that asks you to choose yes, no, or cancel. Command substitution is used  #
# to save your choice to a variable. The script then tests the exit status  #
# of the command.                                                           #
#                                                                           #
# The kdialog command returns a 0 exit code if the Enter key or the Yes     #
# button is pressed. In that case, the script executes the action you       #
# assigned to the if section. In this example it displays a KDialog message #
# box.                                                                      #
#                                                                           #
# The kdialog command returns a 1 exit code if the No button is pressed or  #
# if it is highlighted while the Enter key is pressed. In that case, the    #
# script executes the action you assigned to the first elif section. In     #
# this example it displays a KDialog message box.                           #
#                                                                           #
# The kdialog command returns a 2 exit code if the Esc key or Cancel button #
# is pressed. In that case, the menu executes the action in the second elif #
# section. In this example it displays a KDialog sorry message.             #
#                                                                           #
# If anything else happens, the script executes the action you assigned to  #
#  the else section. In this example it displays a KDialog error message.   #
#############################################################################

kdialog --yesnocancel "PLEASE CHOOSE" --title "YOUR TITLE HERE";
answer="$?";

case "$answer" in
	0)
		kdialog --msgbox "YOU CHOSE YES";
		;;
	1)
		kdialog --msgbox "YOU CHOSE NO";
		;;
	2)
		kdialog --sorry "YOU CHOSE CANCEL";
		;;
	*)
		kdialog --error "ERROR";
		;;
esac;

Back to top

Geometry:

Some of the kdialog commands above may accept the geometry option. Add –geometry WxH to your KDialog command, replacing W with the width you prefer and H with the height you prefer. For example:
kdialog --msgbox "HELLO WORLD" --geometry 250x250

Back to top

Custom Caption and Title:

KDialog displays an Information title and a KDialog caption in the window decoration by default. Thanks to Scott Ferguson, who commented at the bottom of this page, there’s a way to remove those and replace them with custom text by using a combination of the KDialog title option and the KDE caption option. Below is his example, which also contains the KDE icon option to add an icon to the window decoration, and some HTML code to insert a heading, some underlined text, an image, a horizontal rule, a list, and a link. Scott’s KDialog page at https://scottferguson.com.au/community/FOSS/kdialog.html is well worth a visit, and contains information not available in this page.

kdialogcustomcaptioncustomtitlescottferguson

See Scott’s code:

kdialog --error "

Custom window titles are possible!


You can:-
  • use some HTML
  • add images - just make sure you use a valid path
    (note that they're tricky to align)
  • even custom icons - if it's registered
  • Links don't work though :(

Different Kdialogs have different capabilities

" --title "Help" --caption "I'm stuck in the caption box" --icon face-smile-big

An example of a KDialog message box with no caption and no title:

kdialognocaptionnotitle

See the code:

kdialog --msgbox "This is a KDialog message box with no caption and no title."

An example of a KDialog message box with a caption and no title:

kdialogcaptionnotitle

See the code:

kdialog --msgbox "This is a KDialog message box with a caption and no title." --caption "My Caption"

An example of a KDialog message box with a title and no caption:

kdialogtitlenocaption

See the code:

kdialog --msgbox "This is a KDialog message box with a title and no caption." --title "My Title"

An example of a KDialog message box with a caption and a title:

kdialogcaptionandtitle

See the code:

kdialog --msgbox "This is a KDialog message box with a caption and a title." --caption "My Caption" --title "My Title"

Back to top

See also:

Back to top

Links on this page:

Links on this page, in order of appearance, not including the Table of Contents or the Back to top links throughout the page:

Obligatory Happy Ending

And they all lived happily ever after. The end.

Back to top

21 Comments »

  1. With regard to your first line you can also do this.
    With a file which has two (maybe more but not tested) columns you can, pipe the file though kdialog –menu “Select a language:”

    New command line.

    kdialog –menu “select your course: ” $(cat ClassesAvailable) –geometry 700×400

    where the ClassesAvailable file contains:

    a French
    b English
    c German
    d Chinese

    You get the same result.

    Comment by ompaul — April 5, 2011 @ 9:08 am

    • Thanks! I’ve added it above under Menu (alternate method). :)

      Comment by mostlylinux — April 6, 2011 @ 12:23 pm

  2. How do you get the list and coloum option available in zenity under kdialog. Kdialog looks really great but there are no proper tutorial (with example) available on the internet.

    I am writing a bash script with GUI both zenity and kdialog so as to avoid no dependency error. I have completed the zenity part sucessfully but struggling in kdialog, especially in list and coloum (available in zenity). If you know more about kdialog please share with us.

    Thanks and regards,
    sundar_ima

    Comment by sundar_ima — April 13, 2011 @ 4:23 pm

    • I think the closest thing KDialog has to Zenity’s list and column would be the –menu option shown at the top of this page. From everything I’ve been able to find out, KDialog is not as comprehensive as Zenity. Maybe the official KDE TechBase KDialog tutorial will help.

      Linux Magazine did a brief overview comparison of KDialog and Zenity that shows what each is capable of. Enjoy! :)

      Comment by mostlylinux — April 14, 2011 @ 1:00 pm

  3. Wow, the detail is excellent on this. This has been extremely helpful to me, thanks for making the effort to publish this!

    Comment by Anonymous — June 6, 2012 @ 11:46 am

    • Any time, and I’m glad you like it! Let me know if I can improve it in any way. :)

      Comment by mostlylinux — June 6, 2012 @ 5:43 pm

  4. Nice post thank you.
    The link to the Linux Magazine article if broken (needs a href with a url to match the a tags).

    Comment by https://scottferguson.com.au — August 14, 2012 @ 7:14 am

  5. […] here as Zenity is the default for Ubuntu desktops. For information specific to Kdialog check out https://mostlylinux.wordpress.com/bashscripting/kdialog/ which has great examples of using the different options for all you KDE […]

    Pingback by Automate your life with Bash – Part 2 | The Ubuntu Army — September 8, 2013 @ 5:29 pm

    • Does this mean I’m now a soldier in the Ubuntu Army? (:

      Comment by mostlylinux — September 8, 2013 @ 6:32 pm

  6. You have made me a profound impresion! I was looking for a kind of introduction to use gdialog or kdialog and this article has reached all my aims.
    Thanks indeed

    Comment by Anonymous — May 24, 2015 @ 5:30 am

    • You’re welcome! I’m glad you like it! Next will come a page using matedialog and another using zenity. (:

      Comment by mostlylinux — May 24, 2015 @ 3:07 pm

  7. You are fucking pro. Respect.

    Comment by Luca Seemungal — April 7, 2016 @ 4:56 am

  8. Anyone knows if it’s possible to not have the word “Kdialog” forced on the window title?

    We don’t really need to have it thrown on your faces that it’s kdialog specifically and not something using QT more directly, not anymore that we need to be reminded that it’s a bash script or which kernel version it is. Usually we’d prefer to have more of the title space for how we want to label, instead of titles being cut like “Please confirm the… Kdialog”.

    Of course the text on the dialog itself would make it clear, but this is something that objectively affects the interface usability in a negative manner.

    Comment by George Costanza — July 16, 2016 @ 5:39 am

    • It doesn’t look like that’s possible. You can use –title to put a title before KDialog, but you can’t seem to get rid of KDialog from the top of the window entirely. Here’s an example with –title being used with an –error message:

      kdialog –error “YOUR MESSAGE HERE” –title “YOUR TITLE HERE”;

      One way to get away from KDialog in the title entirely is to use passive pop-up messages with –title, like this:

      kdialog –title “EXAMPLE” –passivepopup “MESSAGE” 5;

      Comment by mostlylinux — July 23, 2016 @ 1:07 am

    • Yes. You can have whatever window title you want. Note that the dashes in the following example get mushed by WordPress – replace them with two ordinary dashes

      kdialog --error "<h1>Custom window titles <u>are</u> possible&#33;</h1><img src='/usr/share/icons/nuvola/256x256/apps/klipper.png' width=100><hr>You can:-<ul><li>use some HTML</li><li>add images - just make sure you use a valid path<br><i>(note that they're tricky to align)</i></li><li>even custom icons - if it's registered</li><li><a href='https://scottferguson.com.au'>Links don't work though</a> <b>:(</b></li></ul><h4>Different Kdialogs have different capabilities</h4>" --title "Help" --caption "I'm stuck in the caption box" --icon face-smile-big

      Comment by Scott Ferguson — December 10, 2016 @ 12:25 am

      • Sorry – WordPress ate my code, I could work around it with ASCII codes but I don’t have the time. I’ve emailed the blog author the code, if you’re lucky she’ll find the time to post the answer.

        Comment by Scott Ferguson — December 10, 2016 @ 12:43 am

        • I managed to use ASCII to get WordPress to un-eat the code. I’ll also add a section above that shows the screenshot you sent of this code running on your computer, and will add a few examples of my own that are a bit simpler (no HTML or images), for comparison.

          Comment by mostlylinux — December 11, 2016 @ 12:33 pm

          • Thank you for those edits. There’s a full list of undocumented KDialog options and pictures of examples on my website,
            Notes: there is a link on that page to this excellent page of example scripts; the link in this comment is for those interested in undocumented KDialog options, it’s not to game Google as you, wisely, have “nofollow external” set for comments; I emailed you those examples a few minutes ago, feel free to use what’s on my webpage and to contact me if you need any further explanation/expansion/examples.

            Comment by Scott Ferguson — December 11, 2016 @ 5:00 pm

            • Instead of using what’s on your page I decided to add a link to your page (in the Custom Caption and Title section above). The more resources there are for this, the merrier.

              Comment by mostlylinux — December 14, 2016 @ 8:34 am


RSS feed for comments on this post. TrackBack URI

Comment:

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: