Hello
I didn’t tested the original because I disliked the fact that some instructions were in the tell Finder block.
I got a correct behavior with this slightly edited version.
#!/usr/bin/osascript
#get selection
#use a delimiter that can't conflict with file names; use an forbidden character
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, "/"}
tell application "Finder"
set sel to every text item of (selection as text)
end tell
set AppleScript's text item delimiters to oldTID
#Convert HFS paths into quoted UFS paths
repeat with thePath in sel
set contents of thePath to quoted form of POSIX path of thePath
end repeat
sel
#Convert AppleScript list into a Bash array
set {oldTID, AppleScript's text item delimiters} to {AppleScript's text item delimiters, space}
set thePaths to sel as string
set AppleScript's text item delimiters to oldTID
thePaths
do shell script "rm -Rf " & thePaths
The log report was :
tell application “Finder”
get selection
→ {“Macintosh HD:Users:theAccount:Desktop:des chats copie:chat 4.JPG”, “Macintosh HD:Users:theAccount:Desktop:des chats copie:chat 5.jpg”, “Macintosh HD:Users:theAccount:Desktop:des chats copie:chat 6.jpg”}
end tell
tell current application
do shell script “rm -Rf ‘/Users/theAccount/Desktop/des chats copie/chat 4.JPG’ ‘/Users/theAccount/Desktop/des chats copie/chat 5.jpg’ ‘/Users/theAccount/Desktop/des chats copie/chat 6.jpg’”
→ “”
end tell
Resultat :
“”
KOENIG Yvan (VALLAURIS, France) mercredi 5 juin 2013 14:37:44