Skip to content

Instantly share code, notes, and snippets.

@pmbuko
Last active August 3, 2018 07:56
Show Gist options
  • Save pmbuko/cda49efe0699089f8e71 to your computer and use it in GitHub Desktop.
Save pmbuko/cda49efe0699089f8e71 to your computer and use it in GitHub Desktop.
Use this code in an Applescript to create a file handler that will allow you to click on urls of the form "finder://~/Dropbox/Project/Documents" to open that location in the Finder.
on open location this_URL
-- passed paths should be "finder://[/path/to/directory]
-- spaces in path names should be replaced with a url-friendly '%20'
set x to the offset of ":" in this_URL
set passed_path to text from (x + 3) to -1 of this_URL
set my_path to do shell script "echo \"" & passed_path & "\" | awk '{gsub(\"%20\",\"\\\\ \"); print}'"
do shell script "open " & my_path
end open location
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment