It is currently March 28th, 2024, 12:17 pm

hard disk size

Get help with creating, editing & fixing problems with skins
xsander_7
Posts: 14
Joined: January 3rd, 2019, 6:41 pm

hard disk size

Post 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
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: hard disk size

Post 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.
xsander_7
Posts: 14
Joined: January 3rd, 2019, 6:41 pm

Re: hard disk size

Post by xsander_7 »

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

Image
Last edited by xsander_7 on January 3rd, 2019, 8:20 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: hard disk size

Post 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.
xsander_7
Posts: 14
Joined: January 3rd, 2019, 6:41 pm

Re: hard disk size

Post by xsander_7 »

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

Image
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: hard disk size

Post 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.
xsander_7
Posts: 14
Joined: January 3rd, 2019, 6:41 pm

Re: hard disk size

Post 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?
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: hard disk size

Post 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.
xsander_7
Posts: 14
Joined: January 3rd, 2019, 6:41 pm

Re: hard disk size

Post 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.
User avatar
balala
Rainmeter Sage
Posts: 16109
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: hard disk size

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