Zenity for Windows






Description:

Zenity is a utility used to add GUI forms to scripts and receive feedback from the user. It was designed for use with Linux and GNOME. It uses GTK+ and GLADE libraries. The official website for Zenity is: http://live.gnome.org/Zenity. I have ported the latest version (2.28.0) of this software to Windows (win32). It should work for both XP and Vista.

Screenshot:

Zenity screenshot


Downloads:

Win32 installer:
 
Source code: http://ftp.gnome.org/pub/gnome/sources/zenity/

Known problems:

1: Help files don't build.

2: When executing from a batch script, the annoying black window belonging to "cmd.exe" stays in the background all the time. I have a written a program, "bg_start", to take care of this http://www.placella.com/software/bg_start/.

3: Even though the "win32-3" version is built with support for LIBNOTIFY, this feature does not really work as it requires a "notification daemon", yet I'm not able to find one that works in windows.

4: The program refuses to install on 64-bit systems. To overcome this, you can right-click on the installer, select properties, then tick the box near "Run this program in compatibility mode". It will work just fine then.

How to build from source:

Warning: this is my personal experience, correct as of October 2009 for Zenity 2.28.0, your results may vary!

First thing required is a build environment consisting of a console, a compiler, as well as, GTK+ and GLADE. I set one up as described here: http://www.gtkforums.com/post-4848.html#4848. I also installed "Strawberry PERL", required by intltool, and added the path to PERL binaries to the "$PATH" environment variable in "/etc/profile". And since "intltool" provided with MINGW was outdated I build one from source code and installed it. After downloading Zenity source code and extracting it it, I went ahead and ran the "configure" script. There were many missing dependencies. Most of these are available as binaries from http://ftp.gnome.org/pub/GNOME/binaries/win32/ and http://gnuwin32.sourceforge.net/packages.html. They can be downloaded as a compressed file and extracted into either your GTK or your mingw directory (as you see fit). There are, however, also a few pesky ones, like "scrollkeeper". As far as I know, there is no way to build it using MINGW and MSYS. To get around this, one can execute the following commands from your bash shell (MSYS) (excluding the dollar signs):
$ echo "int main(){}" > foo.c
$ gcc foo.c -o /bin/scrollkeeper-config
$ rm foo.c
This made the "configure" script happy, but, as far as I can see, it also made impossible to build the help files for Zenity.

After the configure script was happy that all the dependencies were satisfied, Zenity still didn't build and "GCC" was complaining about not being able to find "langinfo.h". Eventually I found it in the form of the "libgw32c" library from http://gnuwin32.sourceforge.net/packages.html. I extracted the archive in "/mingw". To make the system aware of this library and resolve a conflict, the following commands need to be issued in MSYS (modify the path to libgw32c to match it's location on your PC):
$ export CFLAGS="-I/mingw/include/glibc -DMINGW_BUILD"
$ export LIBS="-lgw32c"
$ mv /mingw/include/glibc/stdlib.h /mingw/include/glibc/stdlib.h.bak
At this point it is necessary to run "./configure" again to enable "LC_MESSAGES". This should fulfill all requirements and Zenity should build. It will, however, not work. Paths to external files are hard coded into the executable at compile time. For Linux this is perfectly fine as the files within the operating system are very well organised, for Windows this does not work. My solution to this was to modify the source code and get Zenity to check an environment variable (which can be set at install time) to get a path to external files. You can download my patch here: zenity-2.28.0_win32-3.patch It can be applied from inside Zenity's root folder (where the configure script is and where you should have saved the patch) with the following command:
$ patch -p0 < zenity-2.28.0_win32-3.patch
And now Zenity can be built:
$ make
After you export the environment variable "ZENITY_DATADIR" and assign it a value corresponding to the directory containing "zenity.ui" and the pictures from the "data" directory, the program should actually run, too!

I'm not going to explain how the program should be packaged for it to work correctly, if you need to know this I suggest you download the installer and have a look around. Also, you can look at my NSIS script here: zenity-2.28.0_win32-3.nsi


Comments:

Comments to date: 14. Page 1 of 1. Average Rating:

Joel   Tijuana, México

12:31am on Wednesday, September 14th, 2011 

Good, how about a lite version for those who already have gtk2 installed :)?

Good job

Admin:  Well, the chances that one will have exactly the correct version of gtk+ installed are fairly slim, so no...

iGore   Ger

9:41am on Monday, July 18th, 2011 

Hi. I'm trying to write a simple php script, that i run in the cmd of Windows 7(64). My problem is that i dont get back the return value of the pushed button, only the return value of the entry.

$msg = "this is my message";
$rv = shell_exec('zenity --entry --title "Entry" --text "'.$msg.'"');
echo $rv;

How do i get the return values of the pushed button?

thx in advance,
iGore

Admin:  So you want to know if the user pressed 'OK' or 'Cancel'. Well, you are using the wrong PHP function call for that. You should, in fact, be using 'system()'. Here's an example:

<?php
  $msg = "this is my message";
  ob_start();
  $retval = 0;
  $string = system('zenity --entry --title "Entry" --text "'.$msg.'"', $retval);
  ob_end_clean();
  echo $string . "\n" . $retval;
?>

Sundi   US

7:48pm on Sunday, May 15th, 2011 

Does anyone know if I can use the "--no-cancel" command with this version of Zenity to hide the cancel button with the progress bar

Benjamin   California

12:27am on Saturday, April 30th, 2011 

Thank you so much for porting Zenity to Windows! This made it really easy to get my bash scripts to work in both Linux and Windows! This really helped a lot.

Luciano Seibel   Brazil, Sapiranga

8:36am on Friday, March 11th, 2011 

Great!!! For win32 but on my WIN7 64 bits doesnt install ...

Admin:  To use in 64-bit Windows 7 you can right-click on the installer, select properties, then tick the box near "Run this program in compatibility mode". It will work just fine then. Hope this helps.

Shantanu Kumar   Bangalore, India

1:37am on Tuesday, March 1st, 2011 

Zenity for Windows is an excellent tool, but it wiped out my PATH variable on 32-bit Windows 7 and replaced it with its own when I installed it. Hence rating it as dreadful. :-(

KIAaze   Location unknown

1:05pm on Wednesday, February 23rd, 2011

The environment variable ZENITY_DATADIR is incorrectly defined by the installer.

Dony   Brazil

4:35pm on Monday, January 10th, 2011 

Excelent job man!
Thanks, i was searching something like this!

Don't stop!

TheCric   France

11:30am on Saturday, November 13th, 2010 

Very useful on Windows - Great job - Thanks a lot

Agnus   Brazil

2:19pm on Wednesday, July 21st, 2010 

Thanks a lot!
Great Job!

Thx
Regards

Hans   Austria

1:38am on Monday, April 19th, 2010 

Fine tool, this makes life for scripters much easier.

Jack   France

5:07pm on Friday, January 29th, 2010 

I am trying to run it with a portable version of Octave. How to make zenity on win portable.

Admin:  Sorry man, I don't even know what Octave is...

Eric HAMON   Gretz, FRANCE

3:38am on Tuesday, December 29th, 2009 

Excellent. It's very easy to make it portable too.
Thx
Regards

steve   Hungary

4:44am on Monday, November 30th, 2009 

Thanks a lot! :)
Great tool, i missed it from win...

Leave a comment
Your Name:
Your Location:
Vote:
Your Comment:

Security check *

security image



This page was last updated: 8/Nov/2009