Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • December 10, 2016, 02:46:59 AM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: built-in calculator ?  (Read 2812 times)

pixeline

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
built-in calculator ?
« on: December 03, 2008, 03:39:00 AM »
Hi guys,

i recently switched from Launchy to FARR and so far really like it, especially for its low use of system resources. Yet, I do miss the possibility to simply type 5+10= and have 15 displayed. Is it not implemented or am i overlooking something?

thanks for this great software !

Alex

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #1 on: December 03, 2008, 03:45:01 AM »
There's a plugin Fcalc that you can install to do this, you'd type
fc 5+10 and press enter.

Easiest way to get this is to install this plugin and all other ones via DcUpdater if you have that installed. it will list them in the second tab.

pixeline

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #2 on: December 03, 2008, 03:52:49 AM »
works super well! thanks a lot justice !

any easy way to tweak it so i don't even have to type "fc" beforehand ?

d4ni

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 129
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #3 on: December 03, 2008, 07:15:39 AM »
Pretty sure you have to type fc and there is no real way around this. Well, you can shorten it to, say, the '=' sign or something.

justice

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,898
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #4 on: December 03, 2008, 07:17:03 AM »
Go to options -> Hotkeys
Edit or create a new hotkey and add fc followed by a space the following into the 'Text for search edit box', you can then launch FARR with FC already typed in.

pixeline

  • Participant
  • Joined in 2008
  • *
  • Posts: 3
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #5 on: December 03, 2008, 07:30:27 AM »
super, works a breeze. thanks a lot !

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 36,431
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: built-in calculator ?
« Reply #6 on: December 03, 2008, 09:44:33 AM »
there is an easy way to do what you want, dc member Joto did this earlier and meant to post it but didn't.

basically you make an alias in the options which matches numerical expressions, and has the result:
dosearch fc $$1

the tricky part is defining the regular expression and i'm afraid my regex skills are a bit rusty.

maybe someone can figure out a good regex for it and post.



ps. dc member czb has recently written a more powerful calculator plugin for farr which uses javascript; one real nice thing about it is you can add custom functions really easily. i think he'll be posting it very soon.

d4ni

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 129
    • View Profile
    • Donate to Member
Re: built-in calculator ?
« Reply #7 on: December 03, 2008, 03:02:51 PM »
This regexp:

(\d+(?:[+-/*^]\d+)+)


Allows simple expressions, not using any parenthesis but that could be easily fixed I assume. Not much time now :) This way you can use +, -, *, /, and ^. Just add more to the regexp.

Dont put spaces between the numbers and operators, regexp doesn't allow that yet but again, can be added. Gotta go now, mb I'll enhance it later tonight.


--EDIT

Slightly improved:
(\(?\s?\d+(?:\s?[+-/*^]\s?\(?\s?\d+\s?\)?)+).

You can import it directly using this:
1000>>>FCalc>->Calculate $$1 | dosearch fc $$1>+>(\(?\s?\d+(?:\s?[+-/*^]\s?\(?\s?\d+\s?\)?)+)

This allows both parenthesis and spacing between numbers and operators. For example, this is all valid input:
1 + ( 5 * 5 )
1 + (5 * 5)
1 + (5*5)
1+(5*5)

etc.

You can ofcourse expand the equation with more operands and operators. Please note I currently do not allow for more than 1 space, but it's easily adjusted by editing each \s? (whitespace, 1 or 0 times), to \s* (whitespace, zero or more times).

This should be sufficient for most input imho, I hope I am not forgetting something here :). Feel free to improve or (dramatically) change. Not gonna spend a lot more time on this; you can probably increase the amount of available operators (I have only included 5 now) :)
« Last Edit: December 03, 2008, 05:05:34 PM by d4ni »