 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
TheGood
Joined: 30 Jul 2007 Posts: 399
|
Posted: Mon Apr 13, 2009 3:12 pm Post subject: |
|
|
| It would be cool if the function also added a thousands separator comma in the return value. Kind of like how Windows Task Manager does it (in the Processes tab). |
|
| Back to top |
|
 |
Drugwash
Joined: 08 Sep 2008 Posts: 608 Location: Ploiesti, RO
|
Posted: Mon Apr 13, 2009 4:24 pm Post subject: |
|
|
An additional optional parameter could specify the output type (decimal vs binary). For example, if the parameter is D, the output will be kB/MB/GB/TB and if the parameter is B, the output will be kiB/MiB/GiB/TiB.
Default would be D, so this way everybody would (hopefully) be happy. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Mon Apr 13, 2009 11:18 pm Post subject: |
|
|
| TheGood wrote: | | It would be cool if the function also added a thousands separator comma in the return value. Kind of like how Windows Task Manager does it (in the Processes tab). |
A thousands separator? You mean when the result is between 1000 and 1024? Also, if the size were larger than TB (as I opted not to support these) - however, I could easily add them in as well.
| Drugwash wrote: | An additional optional parameter could specify the output type (decimal vs binary). For example, if the parameter is D, the output will be kB/MB/GB/TB and if the parameter is B, the output will be kiB/MiB/GiB/TiB.
Default would be D, so this way everybody would (hopefully) be happy. |
I like the thought of adding this option, but I would have B be the default. - because most programs use binary, not decimal. I will add in this option. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts.
Last edited by animeaime on Mon Apr 13, 2009 11:33 pm; edited 2 times in total |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 399
|
Posted: Mon Apr 13, 2009 11:30 pm Post subject: |
|
|
What I meant was, instead of returning "1452 TB" (random number), it would be nice if it returned "1,452 TB".
I'm sorry, I really should have tested out your function first. Since it already selects the most appropriate unit, you'll rarely have 4 digit numbers anyways (unless, like you mentioned, the file is > 1000 TB ) .
With that said, any chance you could have an option to force a certain unit (as opposed to auto-selecting)? And then, if the result is more than 4 digits long (excluding decimals), add commas at every thousands.
This might be asking too much, lol.  |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Mon Apr 13, 2009 11:33 pm Post subject: |
|
|
I just thought of this. Would it be useful to be able to specify the unit. Default would be "auto" (like it is now), but if you specify "byte/bytes, KB, KiB, MB, MiB, GB, GiB, TB, TiB", then it would be the unit used. In this case, it would override the D/B (Decimal/Binary) option. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Mon Apr 13, 2009 11:35 pm Post subject: |
|
|
| TheGood wrote: | This might be asking too much, lol.  |
No, I'll do that. The default would be "auto" and no commas, but an option would be allowed.
I'm overriding the second, optional, argument to be the "options" argument - instead of just decimal places.
It would function like all other AHK options - space/tab delimited list of options. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Tue Apr 14, 2009 1:18 am Post subject: |
|
|
I'm adding some extra stuff that I thought useful. How should separators after the decimal place look? The default would be nothing, but if specified, how would the breaking look?
ex. 1.234567 MB
would this be?
1.234 456 7 MB?
Of course, I can add customizations, so any ideas are welcome - no idea too crazy  _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1381 Location: The Interwebs
|
Posted: Tue Apr 14, 2009 3:10 am Post subject: |
|
|
Personally, I have never seen separators after a decimal point, at least that I can remember...
But I think that if you're going to put them, spaces would be the best rather than commas, since IMO commas would look very strange after a decimal point.
Especially to anyone who uses commas as the decimal point and periods as the thousands-separator. (Is that in Europe or something?) |
|
| Back to top |
|
 |
TheGood
Joined: 30 Jul 2007 Posts: 399
|
Posted: Tue Apr 14, 2009 3:21 am Post subject: |
|
|
| Yeah, I agree. IMO, I don't think having seperators for decimals would be of any use. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Tue Apr 14, 2009 3:28 am Post subject: |
|
|
| Krogdor wrote: | Personally, I have never seen separators after a decimal point, at least that I can remember...
But I think that if you're going to put them, spaces would be the best rather than commas, since IMO commas would look very strange after a decimal point. |
I've only seen it in text books - but for binary numbers. It will be opt-in. You will be able to specify whatever separator you want (including a space). You will also be able to decide at how many digits you separate (default would be three, if none specified).
| Krogdor wrote: | | Especially to anyone who uses commas as the decimal point and periods as the thousands-separator. (Is that in Europe or something?) |
I'm not sure, but the thousands separator can be whatever you want - a comma, a period, heck even the string "Hello World!". The default will be none, as it is now.
Updates:
I'm giving the function a major revamp - adding in a TON of cool features for converting from any unit to any other unit (even decimal to binary) and with support for decimals. I'm finishing up the conversion part now, and I'll upload it when done. I'll post the options and what they mean. Also, the same description will appear in the file with the function.
It's backward compatable (meaning the default options will be the ones currently used now).
I'm going to add support for the "high" units - like petabyte, exabyte, etc. With the default options for auto, the unit will stop at TeraByte (because I think the others are too rare), but there will be an easy way to overload this - via an option.
Of course, I'll give plenty of examples to show off the function's functionality. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Tue Apr 14, 2009 3:46 am Post subject: |
|
|
OK, another question.
When using auto to convert, should it "down size" decimals.
ex.
.1MB -> 100KB?
or should it remain .1MB? _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Tue Apr 14, 2009 3:52 am Post subject: |
|
|
One more, semantics. Is it -1 byte or -1 bytes?
The code will return 1 byte (instead of 1 bytes), so I was wondering what should it be for negative, since this release supports negatives. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
Drugwash
Joined: 08 Sep 2008 Posts: 608 Location: Ploiesti, RO
|
Posted: Tue Apr 14, 2009 4:13 am Post subject: |
|
|
| I'm for downsizing as default, overridable through options, if possible. |
|
| Back to top |
|
 |
animeaime
Joined: 04 Nov 2008 Posts: 1046
|
Posted: Tue Apr 14, 2009 4:19 am Post subject: |
|
|
OK. Just to clarify, downsizing will only effect the "auto" modes. If you specify a unit to convert to, it will convert to that unit, regardless.
I will add it in as an option. The default will be to downsize, unless I hear objections. You will be able to turn off downsizing. The auto will still function, but it won't downsize numbers less than 1. _________________ As always, if you have any further questions, don't hesitate to ask.
Add OOP to your scripts via the Class Library. Check out my scripts. |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1381 Location: The Interwebs
|
Posted: Tue Apr 14, 2009 5:46 am Post subject: |
|
|
| animeaime wrote: | OK. Just to clarify, downsizing will only effect the "auto" modes. If you specify a unit to convert to, it will convert to that unit, regardless.
I will add it in as an option. The default will be to downsize, unless I hear objections. You will be able to turn off downsizing. The auto will still function, but it won't downsize numbers less than 1. |
Sounds good.
| animeaime wrote: | | One more, semantics. Is it -1 byte or -1 bytes? |
-1 byte sounds more natural to me. |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|