Introduction

Wenity [home] is a multiplatform Zenity [home] clone aimed at (shell) script writers helping them to interact with their users by GUI dialogs.

The premise is to call Wenity from your scripts and the exit code/response file will contain the user selection.

Main properties of Wenity:

Installation

Wenity requires installed Java 6 or higher and, if running on Linux, an X Server. To check if you have the correct Java version, issue java -version from the command line.

Using Wenity

The general usage form of Wenity is:

java -jar wenity.jar [-d] module_name module_parameters

where

java -jar wenity.jar starts wenity
-d enables debug input (optional)
module_name is the name of the module to be invoked
module_parameters are specific to the module to be run

As an example if you issue:

java -jar wenity.jar dialog question "Please select a button bellow:" "Yes,No,Perhaps"

Wenity will show you the following dialog:

Wenity screenshot Wenity screenshot

and the exit code (%ERRORLEVEL% on Windows or $? on Linux) will contain the selected button number counting from 1 (e.g for 'No' it will be 2).

This chapter describes the available modules and the general rules using them, for more examples please refer to the example scripts (example.sh/example.bat).

Processing User Selection

Wenity modules return user selection either in the exit code (%ERRORLEVEL% or $?) or in a response file (wenity_response.txt), based on the requested user interaction.

General exit code values:

Notes:

Dialog Module

The dialog module shows dialogs to the user and returns user selection. Invokation:

java -jar wenity.jar [-d] dialog dialog_type dialog_text button_captions

where

dialog is the module name
dialog_type specifies the dialog type and can be one of QUESTION, WARNING, ERROR, INFO, INPUT
dialog_text is the text to be shown in the dialog. You can use the pipe (|) to break text into more lines
button_captions comma separated list of dialog captions (NOTE: not used if dialog_type is INPUT)

Return value(s)

Dialog module returns user selection in exit code based on the dialog_type:

File Selector Module

The file selector module shows a file chooser dialog and returns the user selected file. Invocation:

java -jar wenity.jar [-d] fileSelector dialog_caption [no_file_error_message]

where

fileSelector is the module name
dialog_caption specifies the caption of the dialog
no_file_error_message if specified the user must select an existing file; if a non-existing file specified this text will be shown to the user

Return value(s)

If exit code is zero (0) then the response file contains the full path to the selected file.

Wenity is developed by Károly Kálmán[home]. This program is free to use and distribute (in original form).

Please note that Wenity is provided as is, without warranty of any kind and the author can not warrant that it is free from errors.

Use Wenity at your own risk!

THANK YOU!

Last modified: Sep 2012