This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Installscript to check available Disk Space
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2010
02:23 PM
Installscript to check available Disk Space
We are working on getting an installscript set up to check disk space when we run our customized MSI installations. We have gotten inconsistent results with what we have so far. When I try to run it it always says the computer does not have the required disk space no matter what number I try. Someone else runs the exact same thing and it does not give him the error.
Here is the script. Any ideas?
function MyFunction(hMSI)
// To Do: Declare local variables.
string szPriVolSpaceRemaining;
number nsize;
begin
// To Do: Write script that will be executed when MyFunction is called.
nsize = MAX_PATH;
MsiGetProperty (hMSI, "PrimaryVolumeSpaceRemaining", szPriVolSpaceRemaining, nsize);
// MessageBox (szPriVolSpaceRemaining, 0);
// This checks if the available space if less than or equal to 2 GB
if (szPriVolSpaceRemaining <= '4194304') then
MessageBox ("You need 2 GB of free space to run this install. The setup will now exit! ", 0);
abort;
endif;
end;
Here is the script. Any ideas?
function MyFunction(hMSI)
// To Do: Declare local variables.
string szPriVolSpaceRemaining;
number nsize;
begin
// To Do: Write script that will be executed when MyFunction is called.
nsize = MAX_PATH;
MsiGetProperty (hMSI, "PrimaryVolumeSpaceRemaining", szPriVolSpaceRemaining, nsize);
// MessageBox (szPriVolSpaceRemaining, 0);
// This checks if the available space if less than or equal to 2 GB
if (szPriVolSpaceRemaining <= '4194304') then
MessageBox ("You need 2 GB of free space to run this install. The setup will now exit! ", 0);
abort;
endif;
end;
(5) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 08, 2010
02:37 PM
It might be that you're doing a string comparison between the property value and "4194304", so anything that comes earlier in alphabetical order would be "less than" that value, and anything alphabetically later would be "greater".
A couple of options might be to call StrToNum and do a numeric comparison; or call GetDiskSpaceEx and skip the property.
If you just want the installer to require some extra space, the best option might be to add a record to the ReserveCost table of your MSI database using the Direct Editor view. The MSI help library describes what to put in a ReserveCost record.
A couple of options might be to call StrToNum and do a numeric comparison; or call GetDiskSpaceEx and skip the property.
If you just want the installer to require some extra space, the best option might be to add a record to the ReserveCost table of your MSI database using the Direct Editor view. The MSI help library describes what to put in a ReserveCost record.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 09, 2010
05:11 AM
I use
// sDir - Directory to check
// nMBytes - needed size in MB
if(GetDiskSpaceEx(sDir, MBYTES) < nMBytes) then
// do something - not enough space
endif;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 09, 2010
08:29 AM
Sorry I am kinda new to installscripts
if i were trying to make sure the drive had at least 2 gigs of space where would I tell the script how much disk space to check for?
if i were trying to make sure the drive had at least 2 gigs of space where would I tell the script how much disk space to check for?
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Jun 10, 2010
07:03 AM
if(GetDiskSpaceEx(TARGTDIR, MBYTES) < 2048) then
MessageBox("omg not enough space.", INFORMATION);
endif;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Aug 11, 2011
01:57 AM
RobertDickau wrote:
It might be that you're doing a string comparison between the property value and "4194304", so anything that comes earlier in alphabetical order would be "less than" that value, and anything alphabetically later would be "greater".
A couple of options might be to call StrToNum and do a numeric comparison; or call GetDiskSpaceEx and skip the property.
If you just want the installer to require some extra space, the best option might be to add a record to the ReserveCost table of your MSI database using the Direct Editor view. The MSI help library describes what to put in a ReserveCost record.
great!!
Thanks!