AutoHotkey Community

It is currently May 26th, 2012, 4:09 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next
Author Message
 Post subject:
PostPosted: April 13th, 2009, 3:12 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2009, 4:24 pm 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2009, 11:18 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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 April 13th, 2009, 11:33 pm, edited 2 times in total.

Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2009, 11:30 pm 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
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 :shock:) .

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2009, 11:33 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 13th, 2009, 11:35 pm 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
TheGood wrote:
This might be asking too much, lol. :D

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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 1:18 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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 :P

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 3:10 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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?)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 3:21 am 
Offline

Joined: July 30th, 2007, 11:32 pm
Posts: 581
Yeah, I agree. IMO, I don't think having seperators for decimals would be of any use.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 3:28 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 3:46 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 3:52 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 4:13 am 
Offline
User avatar

Joined: September 8th, 2008, 12:26 am
Posts: 1048
Location: Ploieşti, RO
I'm for downsizing as default, overridable through options, if possible.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 4:19 am 
Offline

Joined: November 4th, 2008, 9:23 am
Posts: 1045
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: April 14th, 2009, 5:46 am 
Offline

Joined: April 18th, 2008, 7:57 am
Posts: 1390
Location: The Interwebs
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.


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 52 posts ]  Go to page Previous  1, 2, 3, 4  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: G. Sperotto and 13 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group