Double U Blog

personal site and portfolio of Waleed Zuberi

Double U Blog random header image

Currency Conversion with Ubiquity

September 6th, 2008 · 8 Comments · Code

I’ve been playing around with Ubiquity since the day it came out, and I’ve been working on making some routine tasks easier with it.

This time, its a currency conversion command that will get the current approximate value of one currency in terms of the other that you enter. An example command that will convert, say, 10 USD (American dollars) to PKR (Pakistani rupees) is:

currency 10 USD PKR

This will then give you the result right in the Ubiquity window, with no need to open a new tab.

I wanted to use XE’s Universal Currency Converter (UCC) but their terms of use, as I understood them do not allow for automatic extraction of data from their site. This command currently uses Google’s currency converter from iGoogle; be sure to read the disclaimer, as well. If you have a suggestion for a better alternative, I’d be glad to hear it!

To be able to use this command, you need Ubiquity installed and also have to ’subscribe’ to this. Click here, and Ubiquity will present you with an information bar across the top of the window; clicking on the “Subscribe” button will add this command to your subscriptions and you can then start using it right away.

Here’s a screenshot of the Ubiquity command window using this command (click for larger version);

As with all other Ubiquity commands, typing in just part of the command is sufficient for it to understand what you mean — but this, of course, depends on what other commands you have that start with the letters “curr”. You can also take a look at the source code.

Let me know what you think!

Filed under Code

8 responses so far ↓

  • 1 Summer // Sep 8, 2008 at 5:42 pm

    This works really well. I don’t see why using xe.com would make a huge difference. The only thing that makes this a little hard to use is that one needs to know the 3 letter combination of currencies. But that’s not really your fault ;)

    Nice script.

  • 2 Waleed // Sep 9, 2008 at 8:47 pm

    Hey Summer,
    Thanks for the comment!

    I wanted to use XE.com because they have a much larger list of currencies in their Universal Converter. Plus, their rates are more current and people might find that more useful.

    But then again, this isn’t meant to replace anything and I only threw it together to make things easier, so I don’t think that’s a real big issue! Google’s converter does alright for the basic stuff.

    Glad you like the command!
    - Waleed

  • 3 david // Sep 11, 2008 at 7:15 pm

    Hey Waleed
    Good going! The first script I looked for after installing Ubiquity was an fx script, and yours works perfectly.
    Feature suggestion: can you make it check for any selected text on the current page, and use that as the source currency amount? Perhaps coupled with a default target currency that you can save as a user pref somehow… (is that possible with ubiquity? I’m just getting to know it!)
    I’m always browing the web and converting [eg] USD back to GBP, so it would be handy to be able to just select the dollar figure amount on the page that I want to convert and then hit - to bring up the converted rate in GBP.
    Just my 2¢ - er - 1.14p :o)

  • 4 martin // Sep 18, 2008 at 3:19 pm

    Works a treat. Thanks. If you are looking for a new idea then what about “Index Country Name” that just looks up the stock index. That would save me 20 mins a day. Thanks for the FX.

  • 5 Am // Nov 18, 2008 at 9:55 pm

    I’m not getting a return when using your script. The exact conversion I am trying is:
    “currency 270 CDN USD”

    I’ve had no luck with any other conversions.
    I’m on OS X 10.5 using FF 3.0.4

  • 6 Waleed // Nov 20, 2008 at 11:00 pm

    Hi Am,

    I’m assuming you’re trying to convert between Canadian and US dollars, but the symbol for Canadian dollars is CAD, not CDN.

    I’m using the Google Finance converter, so you can take a look at the dropdown menu there to see what the symbol is for the currency you want.

    Hope this fixes it!

  • 7 Daniel // Nov 23, 2008 at 12:52 pm

    Thanks, but why not use the free-text currency conversion that Google offers? You can type “$5 in NIS” in the Google search box, for example, and get the value of five dollars in new Israeli shekels.
    Also, if you type “30 GBP” in the Google search box, you get the value of 30 Great Britain pounds in dollars (even though you didn’t type a target currency).
    Note that for the Israeli shekels, for example, Google search box accepts “NIS” and “shekels” as well as “ILS”, while the finance converter only accepts “ILS”.

    This is why I still prefer copying currency figures I see in pages into the Google search box in my Firefox toolbar, over using this Ubiquity command over it. However, this will change if the “currency” command uses the great Google engine in the search box.

  • 8 Waleed // Nov 23, 2008 at 3:48 pm

    Daniel,
    Thanks for the suggestion!

    I like the flexibility of the Google search currency converter tool, too, but I’ve been unable to figure out a pattern to base the queries I send it upon. For example, the “30 GBP” or “30 shekels” format works, but not for all currencies (just the most popular ones I suppose).

    I could make a separate Ubiquity command that just converts just to USD using the Google search box and accepts all variances of a currency name?

    But the Google search does make things more convenient, so I could put in some sort of error checking, where it would test the search box for a result first, but if no answer was found, it would fall back to the finance converter. But with that there could be an inconsistency with what the user has put in (maybe “shekel”) and what the Google finance converter can understand (”ILS”).

    What do you think?

    - W

Leave a Comment