Subscribeon open {dropped_item}
tell application "Finder"
set the clipboard to "file://" & (URI Escape (POSIX path of the dropped_item))
end tell
end openon open {dropped_item}
set myString to (POSIX path of (the selection as alias))
set search_string to " "
set replacement_string to "%20"
my findReplace(myString, search_string, replacement_string)
tell application "Finder" to set the clipboard to "file:///" & theString
end open
(*============ SUBROUTINE ==============*)
on findReplace(theString, search_string, replacement_string)
if theString contains search_string then
set AppleScript's text item delimiters to search_string
set the text_item_list to text items of theString
set AppleScript's text item delimiters to replacement_string
set the theString to every item in text_item_list as Unicode text
set AppleScript's text item delimiters to ""
end if
return theString
end findReplace
on open dropped_items
set myList to ""
repeat with anItem in dropped_items
set myString to (POSIX path of (anItem as alias))
set search_string to " "
set replacement_string to "%20"
if myString contains search_string then
set AppleScript's text item delimiters to search_string
set the text_item_list to text items of myString
set AppleScript's text item delimiters to replacement_string
set the myString to every item in text_item_list as Unicode text
set AppleScript's text item delimiters to ""
end if
set myList to myList & "file:///" & myString & return
end repeat
set the clipboard to myList
end open
set theSel to (selection of application "Finder")
set pathList to ""
set search_string to " "
repeat with anItem in theSel
set myItem to (POSIX path of (anItem as alias))
if myItem contains search_string then
set myItem to (do shell script "echo " & quoted form of myItem & "|sed \"s/\\ /%20/g\"")
end if
set pathList to pathList & "file://" & myItem & return
end repeat
set the clipboard to pathList
set my_arg to "foo"
set helper_script to posix path of (path to me as text) & "Contents/Resources/Scripts/helper.rb"
set script_output to do shell script helper_script & " --argument " & my_arg
You are not logged in, either login or create an account to post comments
smb://fileserver/blah/blah
Not sure if will help in your case.
posted by wongcorgi at 2:09 AM on July 8