Page 7 of 8

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 10:39
by bdeshi
calc()
Performs one or more calculations and adds the results. Returns the sum of it all.

Syntax

Code: Select all

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.
Examples:

Code: Select all

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)
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.
History:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 10:56
by bdeshi
highend, I added the DUAL: thing to the locked master list. Feel free to adjust that listing.

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 11:00
by highend
Seen it, but the linked topic doesn't exist :ninja:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 11:02
by bdeshi
heheh, fixed. :ninja:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 13:43
by klownboy
Don removed DUAL quite a while ago. I remember being a little bumbed out about it.

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 14:08
by highend
Yep,
v16.90.0316 - 2016-06-30 18:39
- Dual Locations: Removed the DUAL feature that was experimentally added in
v12.50.0005 - 2013-06-19 14:21. It did not have the desired impact and
unnecessarily complicated the code in various places. It has been kind of
hidden and unofficial anyway since it was never added to the help file.
The app is now lighter and faster.

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 15:12
by bdeshi
:oops: d'oh.

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 15:38
by bdeshi
Undocumented Variables:

Code: Select all

<curfs>    returns current path's corresponding filesystem
Examples:

Code: Select all

echo <curfs>; // eg, "NTFS"

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 17:58
by bdeshi
added get() infos:
pidl, pidlname, pidlpath, pdpath, rs, syscolor

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 18:57
by highend
Thanks for adding them, Sammay :tup:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 20:07
by Filehero
@Sammay: is it "just" text mining (release notes) or some sort of reverse engineering?

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 20:22
by bdeshi
well it's kind of text mining, but not just in the release notes.

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 20:56
by Filehero
SammaySarkar wrote: 26 Jan 2019 20:22 well it's kind of text mining, but not just in the release notes.
:tup:

Thanks Sammay and highend for your ongoing efforts! :appl: :appl: :appl:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 20:59
by highend
All mods can change the locked thread and jupe and Sammy did all the work in the last couple of months :oops:

Re: Undocumented script commands - Suggestions

Posted: 26 Jan 2019 21:56
by Filehero
highend wrote: 26 Jan 2019 20:59 All mods can change the locked thread and jupe and Sammy did all the work in the last couple of months :oops:
:oops: :oops: :oops:
What an embarassing omission, how could I've forgotten jupe who to my very surprise joined this community already being an XY expert (I call him Mr. Tweak). So jupe, a big kudos to you as well!

Thanks highend.