分页: 1 / 1

入门 optipng 简单用zenity处理——特别感谢 Cherrot和MaskRay

发表于 : 2012-02-15 5:26
luojie-dune
Zenity 在 GNOME 环境预装,为一GTK+程序。

感谢Cherrot MaskRay MissU和 神。

代码: 全选

#!/bin/bash

# zenity -list --editable $slider $level

 slider=$(zenity --scale --title="Low -> High" --text "Slide right to get higher compression rate" --min-value=0 --max-value=9 --value=1)

# level=$( zenity --list \
#   --title="Compression Level" \
#   --column="Par" --column="Level" --column="Time Use" \
#    o0 Minimal "Minimal"\
#    o4 + "Long"\
#    o7 ++ "Longer"
#);

if [ $? = 1 ]; 
	then zenity --warning --title="" --text="Exiting" --timeout 1;
	exit
fi

 location=$(zenity --file-selection --multiple \
	--separator=$'\n' --file-filter="*.png" \
	--title="File(s) which?");
 
 
 optipng -o"$slider" "$location";
# optipng -$level $location;

dir=$(dirname "$location")

if 
	zenity --question \
          --text="Open Directory?" --timeout 3

then xdg-open $dir; 

else zenity --info --text="Silence." --timeout 1
 
fi