Change Log for the latest
XYplorer BETA version:
Code: Select all
v19.40.0101 - 2018-11-27 16:31
+ Scripting got a new function.
Name: Calc
Action: Performs one or more calculations and adds the results.
Syntax: calc([term=<clipboard>], [separator="<crlf>"], [flags], [precision=0])
term: One or more numbers or mathematical terms (separated by separator).
Numbers can be positive or negative, fractional or integer.
Defaults to the current clipboard contents.
separator: Separator between calculations.
Defaults to CRLF (standard Windows linefeed).
flags: (bit field)
1 = Formats the returned number acc. to system defaults
(thousand separators, decimal digits).
2 = Formats the returned number with X decimal digits (where X
is specified in the "precision" argument) and no thousand
separators. The format is independent of regional settings.
precision: Number of digits after the decimal point in the returned number.
Defaults to 2.
Can also be negative. A negative precision refers to
rounded digits before the decimal point.
return: The sum of it all.
Remarks:
- The terms are calculated, then all results are added to the total result.
- Any leading or trailing spaces, or empty line are ignored.
- Anything that's neither a term nor a number is silently ignored (in
theory; in reality some invalid terms pass the test and you might get a
"Dubious Syntax" warning then).
- If you live in region where "," is the decimal separator you can use
both "," and "." as decimal separators.
- I needed something like this for the bloody tax declaration, so ...
- Whenever you hit on some calculation on your screen, just shoot it up
to the clipboard and do (or have a toolbar button ready):
echo calc();
Examples:
- echo calc("16.1, 3.89, -20", ","); //-0.01
- echo calc("123456.789, 1", ",", 0); //123457,789
echo calc("123456.789, 1", ",", 1); //123.457,79 (German locale)
echo calc("123456.789, 1", ",", 2); //123457,79
echo calc("123456.789, 1", ",", 2, 3); //123457,789
echo calc("123456.789, 1", ",", 2, -3); //123000
- In clipboard: | 77 * 125 |
| 142 * 135 |
| 157 * 145 |
echo calc(); //51560
echo calc(2:=1); //51.560,00 (German locale)
- In clipboard: | 19.99 |
| dog |
| |
| 1/100 |
echo calc(); //20 (the dog and the empty line are ignored)
echo calc(2:=1); //20,00 (German locale)
! Hover Box: The recent changes in the placement logic (v19.40.0004) lead to
some regression. The box would not be shown on the left anymore when there
was not enough space on the right of the mouse. Fixed.
To
download the latest BETA version choose a download package: (1)
Installer Package, (2)
No-Install Package.
Note that BETA versions are work in progress and might contain fresh bugs. You have been warned.
It's a good idea to backup your complete XYplorer settings (menu File | Settings Special | Backup Application Data Folder...)
before running a new BETA version. This will also help in fixing any fresh bugs.