Page 1 of 1

Unit Conversion (Weight, Temperature, etc.)

Posted: Fri Jan 22, 2010 5:04 am
by Cottser
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.

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

Posted: Tue Dec 27, 2011 4:54 am
by beerich
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

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

Posted: Fri Apr 04, 2014 6:14 am
by Kirby Krieger
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.

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

Posted: Fri Apr 04, 2014 10:08 am
by beerich
Heh thanks. I whipped up a bunch of calculators for myself.

Cheers

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

Posted: Fri Jan 09, 2015 4:18 am
by Tele_Pet
Temperature conversion seems not to work when using negative numbers. For example: -40. It might be just me though. Can anyone else confirm?

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

Posted: Fri Feb 20, 2015 8:27 am
by lookinforactions
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.