在nautilus中添加类似windows下发送到u盘的功能

OOo,TeX,KO,ABI,GIMP,Picasa,ProE,QCAD,Inkscape,Kicad,Eagle
回复
pythonlong
帖子: 140
注册时间: 2005-07-29 0:42

在nautilus中添加类似windows下发送到u盘的功能

#1

帖子 pythonlong » 2007-10-12 15:02

gnome-look上的,不过它那个是发送到所有盘,我修改了一下,顺便修改了一个bug,同时把语言改成中文的了。
将代码另存为一个文件中(好像不支持中文),放到~/.gnome2/nautilus-scripts/下面,然后在nautilus右键选中文件。
选择scripts,看到你另存的文件名,选中就可以了。

代码: 全选

#!/bin/bash
# Send-To
##########################################################################
#                        Nautilus "Send to" Script                       #
##########################################################################
#                                                                        #
# Created by Mattia Galati (Adaron)                                      #
# first improvement and translation by Christopher Bratusek (Chrispy)    #
#                                                                        #
##########################################################################
# Language Settings ---------------------------------------------------- #
destination='选择U盘'
title_destination='发送文件到'

copy='复制中....'
title_copy='等待.....'

success='文件复制成功'
title_success='OK'

errors='出现一些问题'
title_errors='错误'

no_writable='目标盘不存在或者禁止写'
title_no_writable='错误'
# End of language settings ----------------------------------------------#
##########################################################################

devices=`ls -m /media/`
vv1=${devices//, sda?/}
vv2=${vv1//cdrom?, /}
vd=${vv2//cdrom, /}
options=${vd//, / FALSE /media/}
destinazione=`zenity --list --title "$title_destination" --text "$destination" --radiolist --column " " --column "Device" FALSE /media/"$options"`
 
if [[ -w $destinazione ]]; then
	cp $NAUTILUS_SCRIPT_SELECTED_FILE_PATHS $destinazione | zenity --progress --pulsate --auto-close --title="$title_copy" --text="$copy"
	if (( $? == 0 )); then
		zenity --info --text="$success" --title "$title_success";
	else	zenity --info --text="$errors" --title "$title_errors";
	fi
else	zenity --info --text="$no_writable" --title "$title_no_writable";
fi
头像
kopision
帖子: 578
注册时间: 2007-05-06 18:11

#2

帖子 kopision » 2008-05-14 20:13

不行啊,插了U盘还是提示目标盘不存在或禁止写,而且选择设备设备的名称很奇怪,请看图,把我所有分区都显示出来了(中间的/media/HAZ'N-THLEY是U盘),而且都是FALSE,这脚本哪里出问题了呢?

汗,忘记附图了,补上
附件
Screenshot-发送文件到.png
上次由 kopision 在 2008-05-15 18:23,总共编辑 1 次。
……
pythonlong
帖子: 140
注册时间: 2005-07-29 0:42

#3

帖子 pythonlong » 2008-05-14 22:32

如果探测到u盘名字中间有空格脚本就会失效:)

后来才发现
头像
kopision
帖子: 578
注册时间: 2007-05-06 18:11

#4

帖子 kopision » 2008-05-15 18:24

我的U盘名字中间没有空格的,之前是打错了 :oops:
……
头像
yangyuruc
帖子: 385
注册时间: 2007-09-26 17:23
来自: 云南-香格里拉

#5

帖子 yangyuruc » 2008-05-15 20:59

楼主可以写个其他脚本么?
就是nautilus文件名太长就会把nautilus撑变形
可以限制显示的文件名长度么,选中后显示全部文件名?
非常感谢
自打用上ubuntu,我决定做一个不盗版的好公民
头像
huangdc
帖子: 94
注册时间: 2006-10-07 14:31

#6

帖子 huangdc » 2008-05-18 22:36

yangyuruc 写了:楼主可以写个其他脚本么?
就是nautilus文件名太长就会把nautilus撑变形
可以限制显示的文件名长度么,选中后显示全部文件名?
非常感谢
这个一直没有解决,不少人对这个有说法,可是一直没有改进,也没听说会解决,暂时办法:忍了。
回复