Unit Conversion (Weight, Temperature, etc.)

Sharing and discussing custom search templates for LaunchBar
Cottser
Rank 1
Rank 1
Posts: 20
Joined: Fri Jan 22, 2010 2:57 am

Unit Conversion (Weight, Temperature, etc.)

Postby Cottser » Fri Jan 22, 2010 5:04 am

I was looking through the documentation and found a great tip on the Calculator page on how to set up Search Templates for use with the calculator.

One of the examples given is converting temperature from Celsius to Fahrenheit, and vice versa.

I decided to make a couple search templates for converting weight between pounds and kilograms. I also found slightly more accurate formulae for the temperature conversions while I was searching for the formulas for weight conversion, so I thought I'd share those as well.

Now, without further ado…

Code: Select all

Name: Convert Pounds to Kilograms
URL: x-launchbar:calculate?argument=*&expression=@*0.4536&title=@%20lbs%20=&result=@%20kg
Encoding: UTF-8


Code: Select all

Name: Convert Kilograms to Pounds
URL: x-launchbar:calculate?argument=*&expression=@*2.205&title=@%20kg%20=&result=@%20lbs
Encoding: UTF-8


Code: Select all

Name: Convert Fahrenheit to Celsius
URL: x-launchbar:calculate?argument=*&expression=(@-32)*5/9&title=@%c2%b0F%20=&result=@%c2%b0C
Encoding: UTF-8


Code: Select all

Name: Convert Celsius to Fahrenheit
URL: x-launchbar:calculate?argument=*&expression=(@*9/5)+32&title=@%c2%b0C%20=&result=@%c2%b0F
Encoding: UTF-8


Of course, there's no need to stop here, but these are the ones that I use on a regular basis.

beerich
Rank 3
Rank 3
Posts: 151
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Unit Conversion (Weight, Temperature, etc.)

Postby beerich » Tue Dec 27, 2011 4:54 am

Hi there. Just found this post.

I looked up the Calculator page, and the Search Templates page. I'm not really sure how you are doing this. I have BBEdit open and want to use your temperature conversions.

There seems to be a couple of options here. I'd like to understand how to implement them all, even though AppleScript and I have a love-hate relationship to this day.

So let's take this example:

Code: Select all

Name: Convert Fahrenheit to Celsius
URL: x-launchbar:calculate?argument=*&expression=(@-32)*5/9&title=@%c2%b0F%20=&result=@%c2%b0C
Encoding: UTF-8


Questions:
- Is that an action saved somewhere?

- Do you start out with your pseudo-English expression before translating into URL encoding?

- What about more complex calculations that might use multiple lines and such? (see next question)

- Can I use Ruby for this sort of thing?

Looking forward to this. I'd really like to extend LB, but have been confused for some time. I guess it's time to fix that.

Cheers

Kirby Krieger
Posts: 12
Joined: Thu Jul 21, 2011 10:06 pm

Re: Unit Conversion (Weight, Temperature, etc.)

Postby Kirby Krieger » Fri Apr 04, 2014 6:14 am

Better late and all that … :D

These get entered in LaunchBar: "Index ▹ Show Index ▹ Search Templates (UTF-8) ▹ Index ▹ Add". Paste the description in the name column, and the x-launchbar part in the Details column.

beerich
Rank 3
Rank 3
Posts: 151
Joined: Thu Apr 05, 2007 11:05 am
Location: Toronto

Re: Unit Conversion (Weight, Temperature, etc.)

Postby beerich » Fri Apr 04, 2014 10:08 am

Heh thanks. I whipped up a bunch of calculators for myself.

Cheers

Tele_Pet
Posts: 7
Joined: Tue Jun 17, 2014 3:40 pm

Re: Unit Conversion (Weight, Temperature, etc.)

Postby Tele_Pet » Fri Jan 09, 2015 4:18 am

Temperature conversion seems not to work when using negative numbers. For example: -40. It might be just me though. Can anyone else confirm?

lookinforactions
Posts: 5
Joined: Wed Feb 18, 2015 8:09 am

Re: Unit Conversion (Weight, Temperature, etc.)

Postby lookinforactions » Fri Feb 20, 2015 8:27 am

Hi there Cottser,
Thanks for the scripts, they have helped me a lot. Is there anyway you can make one for length between feet and meters. Thanks.


Return to “LaunchBar Search Templates”

Who is online

Users browsing this forum: No registered users and 2 guests

cron