Archive for July, 2010

publicLink: the process

July 13, 2010 4 comments


In this post I will explain the process of my action/script for quicksilver. The action is quite simple; you choose a file that is currently on your public folder via quicksilver and then run the publicLink action to get the public link and paste it anywhere you need it.

The problem:

I started using Quicksilver and loved functions like move to and copy to. Then I started using dropbox and using the copy to and move to the dropbox folder. The problem was that I had to manually get the public link for any file in the dropbox folder. This was very disruptive when you are used to using quicksilver and its simple functions. Also, I always had to get the main index file from my dropbox folder (search: pyndexer) so it was not productive getting the same link over and over again manually.

The usual solution:

Search. I started searching for the solution but I had no luck. So I decided it was time to use my programming skills and make it myself.

First step:

I searched for the requirements for a quicksilver script. I found that you needed applescript knowledge. This was the first time I heard of this scripting language so I decided to read a couple of things and look for examples.

I came across three vital webpages that I used for my solution.

I knew I needed a find and replace algorithm so I decided to search for a pre-made one. The first link was useful for seeing how to interact with the clipboard. The third link was useful for seeing different examples and one script very similar to my solution but different at the same time.

Testing the work:

When I finished my script, I didn’t worried about a method to see if there were characters not used in URLs like spaces and other symbols. I decided to try it and see how it worked without it. It worked! It turns out that most browsers (if not all, I tried with 3) replace this characters when pressing enter and it redirects you to the correct webpage. I did a quick test to see different types of names of the files and everything worked.

The solution:


What I learned:

I learned that it’s pretty awesome to develop your own solutions. I felt powerful. Also I wanted to share the solution if somebody else needs it. It’s pretty cool what you can achieve in a long night with some searching skills and basic developing knowledge.


Installing publicLink quicksilver + dropbox action

July 13, 2010 8 comments
First you have to open the "applescript editor EDIT:(or script editor)" and copy
the code available here. Change both properties and save
it on the specific location with the name "publicLink"
and your done. Use quicksilver to search for a file that you
know that it's on your public folder and then press tab
and then type "publicLink" and then press enter.
You will have on your clipboard the link ready to be shared! 

EDIT* the final step is to restart quicksilver

Where to save:
~/Library/Application Support/Quicksilver/Actions
Be sure to replace both properties!
to get your public dropbox folder, locate it in the finder
then click get info and on the general tab it says "where"
copy that string and add "/public/"

property ifolder : "/Users/maltigloos/Dropbox/Public/"
property dropboxID : 123456

on findAndReplace2(toFind, toReplace, theText)
set astid to AppleScript's text item delimiters
set AppleScript's text item delimiters to toFind
set textItems to theText's text items
set AppleScript's text item delimiters to toReplace
tell textItems to set editedText to beginning & toReplace & rest
set AppleScript's text item delimiters to astid
return editedText
end findAndReplace2

using terms from application "Quicksilver"
on open theseitems
if application "Dropbox" is not running then launch application "Dropbox"
repeat with aitem in theseitems
tell application "Finder"
set r to POSIX path of (aitem as text)
set completePath to r as text
set docName to my findAndReplace2(ifolder, "", completePath)
set theurl to "" & dropboxID & "/" & docName
set the clipboard to theurl
end tell
end repeat
end open
end using terms from

For more info check this!