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

sh/bash/dash/ksh/zsh等Shell脚本
回复
头像
luojie-dune
帖子: 22033
注册时间: 2007-07-30 18:28
系统: Linux
来自: 空气中

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

#1

帖子 luojie-dune » 2012-02-15 5:26

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
『这个世界都是我的 ,我爱你们』

ENTP ⥂ INTP ⥄ INFP ⇦ INTJ

在此发布的文章使用 Creative Commons Attribution-ShareAlike 4.0 协议
回复