Determine Amount of Free Space on a Drive

  • Konuyu başlatan Konuyu başlatan guclusat
  • Başlangıç Tarihi Başlangıç Tarihi

guclusat

Tanınmış Üye
Süper Moderatör
Determine Amount of Free Space on a Drive
When installing software to a user's system, it is useful to ensure that the user's system has enough free space on their hard drive to accommodate the software.

To accomplish this in AutoPlay Media Studio:

  1. Insert the following code into any event in your application:
Kod:
--space required, in megabytes
space_required = 253

--get free space on the user's system (c:\ drive)
space_available = Drive.GetFreeSpace("C:");

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

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