MSI Factory 2.3

Drive.GetFreeSpace

Drive.GetFreeSpace

This is the first topic This is the last topic  

Drive.GetFreeSpace

This is the first topic This is the last topic  

OverviewExamples

number Drive.GetFreeSpace (

string Drive )

Example 1

Free_Space = Drive.GetFreeSpace("C:\\");

Gets the free disk space on the user's "C:\" drive and stores the result in a variable called "Free_Space."

Example 2

how_big = Drive.GetFreeSpace(Read_Drive);

Takes the variable "Read_Drive" that contains a path with a drive letter and stores the free disk space value in how_big.

Example 3

--space required, in megabytes

space_required = 253

 

--get free space on the user's system (c:\ drive)

space_available = Drive.GetFreeSpace("C:");

 

-- Determine if an error occurred.

error = Application.GetLastError();

 

-- If an error occurred, display the error message.

if (error ~= 0) then

   Dialog.Message("Error", _tblErrorMessages[error], MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);

else

 

   --compare free space available to free space required

   if space_required > space_available then

       Dialog.Message("","You are "..(space_required - space_available).." MB short");

   else

       Dialog.Message("","You have "..(space_available - space_required).." MB more than you need");

   end

end

Determines if the user has enough free space on their system given a space requirement.

Note: The variable space_required must be set by you. 253 is an arbitrary number.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us