Page 1 of 3

hard disk size

Posted: January 3rd, 2019, 6:50 pm
by xsander_7
как вывести размер свободного места диска в гигабайтах если размер диска 1,8 tb. надо что бы размер был написан (пример) 1050 GB а сейчас выводит 1,0 TB .

how to display the amount of free space of the disk in gigabytes if the size of the disk is 1.8 tb. it is necessary that the size was written (example) 1050 GB and now displays as 1.0 TB .

сейчас такImage
надо Image

Re: hard disk size

Posted: January 3rd, 2019, 7:51 pm
by balala
xsander_7 wrote: January 3rd, 2019, 6:50 pm how to display the amount of free space of the disk in gigabytes if the size of the disk is 1.8 tb. it is necessary that the size was written (example) 1050 GB and now displays as 1.0 TB .
Probably the String meter which shows the storage space has an AutoScale=1 option set. Due to this, it scales the space into the best unit possible. If you want to show this information in bytes, kBytes, MBytes or GBytes, but not in TBytes, you have to make manually the conversion.
For example use the following measures:

Code: Select all

[Rainmeter]
Update=1000

[Variables]
Disk=- ENTER HERE THE DRIVE LETTER -

[MeasureTotalDiskSpace]
Measure=FreeDiskSpace
Drive=#Disk#
Total=1
UpdateDivider=5

[MeasureTotalDiskSpaceScaled]
Measure=Calc
Formula=(( MeasureTotalDiskSpace > ( 1024 ** 3 )) ? ( MeasureTotalDiskSpace / ( 1024 ** 3 )) : (( MeasureTotalDiskSpace > ( 1024 ** 2 )) ? ( MeasureTotalDiskSpace / ( 1024 ** 2 )) : (( MeasureTotalDiskSpace > 1024 ) ? ( MeasureTotalDiskSpace / 1024 ): MeasureTotalDiskSpace )))

[MeasureTotalDiskSpaceUnit]
Measure=Calc
Formula=(( MeasureTotalDiskSpace > ( 1024 ** 3 )) ? 3 : (( MeasureTotalDiskSpace > ( 1024 ** 2 )) ? 2 : (( MeasureTotalDiskSpace > 1024 ) ? 1 : 0 )))
Substitute="0":"","1":" k","2":" M","3":" G"

[MeterDrive]
Meter=STRING
MeasureName=MeasureTotalDiskSpaceScaled
MeasureName2=MeasureTotalDiskSpaceUnit
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=#Disk# storage space:#CRLF#%1%2B
In this code:
  • [MeasureTotalDiskSpaceScaled] returns the scaled storage space.
  • [MeasureTotalDiskSpaceUnit] returns (through a substitution) the used unit (bytes, k, M or G).
See that I removed the AutoScale=1 option from the [MeterDrive] String meter. Since the scaling is done manually, this option isn't needed anymore.

Re: hard disk size

Posted: January 3rd, 2019, 8:10 pm
by xsander_7
balala wrote: January 3rd, 2019, 7:51 pm
displays the capacity of the disk. need to how many free

Image

Re: hard disk size

Posted: January 3rd, 2019, 8:18 pm
by balala
xsander_7 wrote: January 3rd, 2019, 8:10 pm Image
I think you didn't add the appropriate drive letter to the Disk variable into the [Variables] section. This is an extremely important step to make the skin to work. Please add it and retry the code.

Re: hard disk size

Posted: January 3rd, 2019, 8:21 pm
by xsander_7
balala wrote: January 3rd, 2019, 7:51 pm
displays the capacity of the disk. need to how many free

Image

Re: hard disk size

Posted: January 3rd, 2019, 8:26 pm
by balala
xsander_7 wrote: January 3rd, 2019, 8:21 pm displays the capacity of the disk. need to how many free
Just remove the Total=1 option from the [MeasureTotalDiskSpace] measure.

Re: hard disk size

Posted: January 3rd, 2019, 8:37 pm
by xsander_7
balala wrote: January 3rd, 2019, 8:26 pm Just remove the Total=1 option from the [MeasureTotalDiskSpace] measure.
Thanks so much. it's fantastic.
Image

if you have any questions, can I ask you in this post?

Re: hard disk size

Posted: January 3rd, 2019, 8:56 pm
by balala
xsander_7 wrote: January 3rd, 2019, 8:37 pm if you have any questions, can I ask you in this post?
Sorry, what you mean? You or me have any question?
If you are who have question, feel free to ask or to open a new topic if the question is related to a completely different thing.

BTW, I'm glad if you got it working as expected.

Re: hard disk size

Posted: January 3rd, 2019, 9:03 pm
by xsander_7
balala wrote: January 3rd, 2019, 8:56 pm Sorry, what you mean? You or me have any question?
I may have questions. so the translator translates

If you are who have question, feel free to ask or to open a new topic if the question is related to a completely different thing.
okay, thanks.

Re: hard disk size

Posted: January 3rd, 2019, 9:09 pm
by balala
xsander_7 wrote: January 3rd, 2019, 9:03 pm I may have questions. so the translator translates
Ok, doesn't matter. Just post them anytime you have any.