property doc_root : "/Library/WebServer/Documents"
property local_host : "http://localhost"
on open these_items
repeat with i from 1 to the count of these_items
set this_item to POSIX path of item i of these_items
try
do shell script "
open `echo " & this_item & " | perl -pe 's#([^[:alnum:]/\\.\\n_-])#sprintf(\"%%%x\", ord($1))#eg; s#^" & doc_root & "#" & local_host & "#'`
"
on error
display dialog "Could not find " & this_item & " in your web folder." buttons {"Ok"} giving up after 10 default button 1
end try
end repeat
end open
on run
display dialog "Drop a file on this applescript and it will be opened as http://localhost/..." buttons {"Ok"} giving up after 10 default button 1
end run
open open-local-url in the applescript editor