Undocumented script commands - Suggestions

Discuss and share scripts and script files...
SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

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:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

highend, I added the DUAL: thing to the locked master list. Feel free to adjust that listing.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 9557
Joined: 06 Feb 2011 00:33

Re: Undocumented script commands - Suggestions

Post by highend »

Seen it, but the linked topic doesn't exist :ninja:
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

heheh, fixed. :ninja:
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

klownboy
Posts: 3065
Joined: 28 Feb 2012 19:27

Re: Undocumented script commands - Suggestions

Post by klownboy »

Don removed DUAL quite a while ago. I remember being a little bumbed out about it.

highend
Posts: 9557
Joined: 06 Feb 2011 00:33

Re: Undocumented script commands - Suggestions

Post 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.
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

:oops: d'oh.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

Undocumented Variables:

Code: Select all

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

Code: Select all

echo <curfs>; // eg, "NTFS"
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

added get() infos:
pidl, pidlname, pidlpath, pdpath, rs, syscolor
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

highend
Posts: 9557
Joined: 06 Feb 2011 00:33

Re: Undocumented script commands - Suggestions

Post by highend »

Thanks for adding them, Sammay :tup:
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Filehero
Posts: 2413
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Undocumented script commands - Suggestions

Post by Filehero »

@Sammay: is it "just" text mining (release notes) or some sort of reverse engineering?

SammaySarkar
Posts: 4235
Joined: 12 Mar 2014 17:27
Location: Asteroid B-612 / Dhaka
Contact:

Re: Undocumented script commands - Suggestions

Post by SammaySarkar »

well it's kind of text mining, but not just in the release notes.
Icon Names | Onyx | Undocumented Commands | xypcre
[ this user is asleep ]

Filehero
Posts: 2413
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Undocumented script commands - Suggestions

Post 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:

highend
Posts: 9557
Joined: 06 Feb 2011 00:33

Re: Undocumented script commands - Suggestions

Post by highend »

All mods can change the locked thread and jupe and Sammy did all the work in the last couple of months :oops:
One of my scripts helped you out? Please donate via Paypal or paypal_donate (at) stdmail (dot) de

Filehero
Posts: 2413
Joined: 27 Feb 2012 18:50
Location: Windows 10 Pro x64

Re: Undocumented script commands - Suggestions

Post 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.

Post Reply