8/06/2009

nautilus script : copy selected path to clipboard



#!/usr/bin/python
# -*- coding: UTF-8 -*-
# file copy_sel_path_to_clipboard.py

import os, gtk #, glob

def showme(s):
os.system('gmessage -center -title "Path" "' + str(s) + '"')

tmp = os.environ['NAUTILUS_SCRIPT_SELECTED_FILE_PATHS']
fns = tmp.strip().split('\n') #filenames
if len(fns) == 1 :
cb = gtk.clipboard_get()
cb.set_text(fns[0])
cb.store()
else :
showme('Only 1 file must be selected')

댓글 없음: