Creo que este Applescript guardado como un servicio lo hará:
(Establecido en "Servicio recibe seleccionado files or folders
en Finder
")
on run {input, parameters}
set basePath to "users/username/folder/"
set baseURL to "http://localhost"
repeat with i in input
tell application "Safari"
if not (exists (document 1)) then
--
-- Safari is *Not* Opened, Call Open New Window Function, Go To Preferred Page
-- and Activate Safari to Enable Scripting
--
tell application "Safari" to activate
my open_new_window()
--
-- Set Safari Location to Preferred Page
--
set theFileName to POSIX path of i
set thePath to text (length of basePath+1) thru -1 of theFileName
set the URL of document 1 to baseURL & thePath
else
--
-- Safari is Opened, Bring it To Front and Open New Tab w/Preferred Page
--
if (exists (URL of document 1)) then
my open_new_tab()
end if
--
-- and Activate Safari to Enable Scripting
--
tell application "Safari" to activate
--
-- Set Safari Location to Preferred Page
--
set theFileName to POSIX path of i
set thePath to text (length of basePath+1) thru -1 of theFileName
set the URL of document 1 to baseURL & thePath
end if
end tell
end repeat
return input
end run
--
-- Open New Window Function
--
on open_new_window()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Window" of menu "File" of menu bar 1
end tell
end tell
end open_new_window
--
-- Open New Tab Function
--
on open_new_tab()
tell application "Safari" to activate
tell application "System Events"
tell process "Safari"
click menu item "New Tab" of menu "File" of menu bar 1
end tell
end tell
end open_new_tab
¡Juntado de unas cuantas fuentes!