ATTENTION: You are viewing a page formatted for mobile devices; to view the full web page, click HERE.

DonationCoder.com Software > Post New Requests Here

DONE: Commandline Calculator (for Farr)

(1/3) > >>

jgpaiva:
Farr is my most loved app. I use it to launch everything, and i hope soon, it'll have even more uses.
But I'd like Farr to be my calculator.
Without bugging mouser to include this in Farr, i can just add a groups alias that has a regex that detects mathematics operators (something like: ((.*)+(.*))|((.*)-(.*))
And then, associate it with a ahk script that takes command line parameters, and have the group alias launch it with the expression that i type.
Up until now, everything is easy. The problem is, making the program that does the calc.
I tried something like:


--- ---;Calc
if 0 < 1 ; if there are not command line parameters, exit
  ExitApp
Expr=
Loop %0%
  {
  counter := %a_index%
  Expr=%Expr%%counter% 
  }
StringReplace CompleteExpr, Expr,`,,.,ReplaceAll
Result:=0 + Expr
MsgBox,.%Result%.
return
But the line "Result:=0 + Expr" isn't interpreted as i expected, Expr has to be a number, and it's an expression :(
Any ideas?
Or maybe some command line app that does this?
Hope you can help me! thanks!

mouser:
dont know autohotkey enough to answer this, but thought i would add two things:
1) might be nice to have it copy the result to the clipboard.
2) an alternative alias if you want to specify an explicit command instead of trying to detect all math expressions would be just to have a regex expression of:  calc (.*)
im not saying you couldn't use a regex like you want that would let you just type any expression, just saying using a keyword like calc would free you from having to figure out the regular expression that covers all expressions.

jgpaiva:
1) Very good idea! When i found out how to do this, I'll add that option!
2 )I already have the alias calc for windows calculator ;) And i prefer to just type ahead, usually, i want to know the result as fast as possible :D

skrommel:
 :) Lazlo has an AHK solution over at http://www.autohotkey.com/forum/viewtopic.php?t=5060.

You could also download calc387.zip from http://home.att.net/~short.stop/freesoft/calc.htm

Skrommel

mouser:
gerome, (one of?) the primary developer of FSBL (see end of https://www.donationcoder.com/forum/index.php?topic=1167.msg15008#msg15008) ,

has made a tiny little FSBL script for this with instructions on how to use the very cool online compiler to make a 100k exe of it.
i've tested it and it works like a charm!

here's the script:


--- ---$AppType GUI
Dim $cmd = Remove( command(-1), Chr(34) )
Dim $code = "Dim $result = " & cmd & ": Return result"
Dim $resulttext = $cmd & " = " & Execline(code)
Msgbox( Null, $resulttext ,"Result:", MB_OK )
ClipBoardSetText( $resulttext )


You can compile that into a small exe by pasting it into this page and hitting build (use left button):
http://gedd123.free.fr/studio/fbsl2exe.php

that will generate for you a 100k exe that I saved my compiled exe as runbox2.exe

which you can configure this way for farr:




With results like this:



nice!!!!

Navigation

[0] Message Index

[#] Next page

Go to full version