next up previous
Next: Libraries Up: Using z-Tree with Linux Previous: Introduction

Starting and stopping

wine knows three ways to handle applications. The default is managed, which means that application windows appear like any other window of an X application on the desktop. This works quite well with the server application ztree.exe. Thus, a convenient way to start z-Tree is, e.g.,

wine ztree.exe /language english
In the lab environment the same procedure can be used for z-Leaf (you can put the following line into a shortcut on your desktop):
wine zleaf.exe /language english
However, to test your program you want several z-Leaves in separate little windows (you can put each line into a different shortcut on your desktop):
wine explorer /desktop=1,640x480 zleaf.exe /language english /name lab01
wine explorer /desktop=2,640x480 zleaf.exe /language english /name lab02
wine explorer /desktop=3,640x480 zleaf.exe /language english /name lab03
wine explorer /desktop=4,640x480 zleaf.exe /language english /name lab04
z-Tree can be stopped by clicking the close button or with the help of the File / Quit menu.

z-Leaf must be killed manually. The following line does the trick (you can put the command into a shortcut on your desktop):

ps axuww | grep "zleaf.exe" | grep "/name" | gawk '{ print "kill -KILL " $2 "; " }' | bash
(This works with Wine 0.9.24, the output of ps may look differently with older versions of wine)

If you need many z-Leaves, you can use the following script to conveniently start and restart several instances of z-Leaf simultaneously:

#! /bin/bash
if [[ $1 == "" ]];
then echo "please tell me how many leaves to start";
exit;
fi
#first kill all old leaves
ps axuww | grep "zleaf.exe" | grep "/name" | gawk '{ print "kill -KILL " $2 "; " }' | bash
# now start the new leaves
for ((i=1;$i<=$1;i++));
  do /usr/bin/wine explorer /desktop=$i,640x480 zleaf.exe /name lab$i &
done
Calling this script with the number of desired z-Leaves as an argument will first kill all old z-Leaves and then start the new ones which will be consecutively numbered.


next up previous
Next: Libraries Up: Using z-Tree with Linux Previous: Introduction
Oliver Kirchkamp 2007-08-01