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

Other Software > Developer's Corner

[FBSL] FARR's Calc tool updated!

(1/1)

Gerome:
Hello,

I've improved my FARR's calculator!

Here's the link : http://gedd123.free.fr/Fbsl/DC/FBSLCalc_16-09.zip

How to install Fbslcalc.fbs into FARR ?
-1- Copy FBSLCalc.exe into \FindAndRunRobot\Scripts\
-2- Open FARR and edit Option, select the 'calc'item,and replace its regex config with this one :
calc $$1 | Scripts/FBSLCalc.exe "$$1"
-3- Save

That'all folks!
Now you can play with the newest calc :)

Usage : FBSLCalc.exe expression

Examples :
basic sample :
Calc 2+2
It'll return '4'

graphical sample :
calc /code=FBSL_Control("Button", Me, "Hello", 1000, 10, 10, 75, 23, 0, 0):show(me):begin events:If CBMsg = WM_COMMAND And CBCTL =1000 then msgbox(0, "Button clicked!", "yoo", 0):end events
it'll afx a form with a button, then just click onto the button... :)

sample sample :
calc /code=ExecLine(FileLoad("./PMem.fbs"))

Enjoy!

Here is the source of the newest FARR's calc :

--- Code: Text ---#Option Explicit'#AppType Console If Not STANDALONE Then    Fbsl2Exe( Command(1) ): ExitProgram(0)End If '// -----------------------------------------------------------------'// GEG 26 September 2006'// FBSLCALC.EXE 2.5/56*PI'// FBSLCALC.EXE /code=msgbox(Null,"Hello","Test",MB_ICONINFORMATION)'// -----------------------------------------------------------------Static $code, $resulttext, $result, $cmd = Command(-1), ch34 = Chr(34), ch92 = Chr(92)If cmd = "" Then    MsgBox(NULL, "You need to specify an expression to evaluate, like 2+2." & crlf & _                "If you encounter any problems, tell'em there : " & crlf & _                "http://www.fbsl.net/phpbb2/index.php", _                "Freestyle Basic Script Langage (FBSL) Calculator:", MB_OK +MB_ICONINFORMATION)    ExitProgram(1)End If cmd = Replace(cmd, ch34 & ch34, "")If Left(cmd, 1) = ch34 AndAlso Right(cmd, 1) = ch34 Then    cmd = Mid(cmd, 2, StrLen(cmd) - 2)End If If Instr(cmd,"/code=") Then    cmd = Remove(Trim(cmd), "/code=")    code = "result = " & cmd & " : Return result"    resulttext = cmd & " = " & ExecLine(code)Else    cmd = Replace(Trim(cmd), ",", ".")    code = "result = " & cmd & " : Return result"    ExecLine(code)    result = Replace(result, ".", GetLocalSeparator())    resulttext = cmd & " = " & resultEnd If If StrLen(cmd) = 0 Then ExitProgram(-1) ClipboardSetText(result)'resulttext)MsgBox(NULL, resulttext, "Freestyle Basic Script Langage (FBSL) Calculator / Executor:", _       MB_OK+MB_ICONINFORMATION) Function GetLocalSeparator()    Dim $Buffer * 4    ApiCall( "GetNumberFormat", "kernel32", 0, 0, "1.1", 0, @Buffer, Len(Buffer) )    Return Mid(Buffer,2,1)End Function

jgpaiva:
And here's the regex i use: (notice that it only works for the calculator itself)


--- ---(.*\+.*|.*\-.*|.*\*.*|.*\/.*)this expression will match anything that includes a *, +, / or -, which means you are able to do maths only by typing it in farr instead of having to prepend "calc".

(i know, it's not a very good expression since it uses the . aka dot)

Navigation

[0] Message Index

Go to full version