Skip to content

Instantly share code, notes, and snippets.

@mfilej
Created October 25, 2009 02:15
Show Gist options
  • Save mfilej/217844 to your computer and use it in GitHub Desktop.
Save mfilej/217844 to your computer and use it in GitHub Desktop.
Copy public iDisk URL from Finder (automator action)

Copy public iDisk URL from Finder

iDisk is not the best user experience Apple has to offer and I hope that they are going to realize that in the near future. One of it's many flaws is the lack of a simple way to get the public URL for a file (without opening the web interface), preferably from the Finder.

This is a script for Automator. Create a new service and select "Service receives selected Files or folders in Finder". Add the "Run shell script" action from the library and insert the code from convert_path_to_idisk_url.rb. Save as "Copy public URL".

Open Finder, select a file, go to Finder ➞ Services ➞ Copy as public URL.

You have to wait for the script to execute, it can take a second or two. There is no feedback when the script is done.

I recommend adding a keyboard shortcut via System Preferences ➞ Keyboard Preference Pane. Mine is ⌃ + ⌘ + C.

screenshot

require 'cgi'
dirs = ARGF.first.chomp.split('/')
dirs.slice! 0, 4
dirs.map! { |dir| CGI.escape(dir).gsub("+", "%20") }
suffix = dirs.join "/"
`echo "http://idisk.mac.com/mfilej/Public/#{suffix}" | pbcopy`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment