cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
jchristman
Level 8

Installscript check drive type

Is there a way to have Installscript check a drive type?

I am listing drives in a combobox and do not want to list floppy drive or a cd/dvd drive, I want to only list volume/hard drives.
Labels (1)
0 Kudos
(3) Replies
RobertDickau
Flexera Alumni

How are you generating the list of drives? GetValidDrivesList, for example, enables you to specify which type or types it should report...
0 Kudos
jchristman
Level 8

Yes I am using the GetValidDriveList


// Define properties --------------------------------------------------------
#define DRVCOMBOBOX1 1203

// Set Prototypes -----------------------------------------------------------
prototype ChangeDrive();
// Included header files ----------------------------------------------------
#include "ifx.h"


function NUMBER ChangeDrive( )
NUMBER nReturn;
NUMBER nControl;
BOOL bDone;
// variables for combo box list and current selection
LIST listDrives;
STRING svDrive, svReturnString,szMsg,svNewPath;

begin
nReturn = EzDefineDialog("ChangeDrive", ISUSER, "ChangeDrive", 0);

bDone = FALSE;

// create the list containing the combo box items
listDrives = ListCreate(STRINGLIST);
// fill the list with all available drive letters
GetValidDrivesList(listDrives, -1, -1);
CtrlSetCurSel("ChangeDrive", DRVCOMBOBOX1, svDrive);
while (!bDone)

nControl = WaitOnDialog("ChangeDrive");

switch (nControl)
case 2, DLG_CLOSE:
Do(EXIT); // The user clicked the window's close button.

case DLG_ERR:
MessageBox ("Dialog failed.", SEVERE);
bDone = TRUE;

case DLG_INIT:

// associate the list with the combo box
CtrlSetList("ChangeDrive", DRVCOMBOBOX1, listDrives);
// get the first drive letter from the list...
ListGetFirstString(listDrives, svDrive);
// ...and make it the current selection
CtrlSetCurSel("ChangeDrive", DRVCOMBOBOX1, svDrive);


case SD_PBUT_EXITSETUP: //Cancel button
Do(EXIT);
bDone=TRUE;

case SD_PBUT_BACK:
ListDestroy(listDrives);
EndDialog("ChangeDrive"); // Close the dialog box.
ReleaseDialog("ChangeDrive"); // Free the dialog box from memory.
return BACK;


case SD_PBUT_CANCEL: //Esc key
Do(EXIT);

case SD_PBUT_CONTINUE: // Continue on

CtrlGetCurSel("ChangeDrive", DRVCOMBOBOX1, svDrive);
svNewPath = svDrive + ":\\Program Files\\MYAPP\\"; //+ svNewPath;
TARGETDIR = svNewPath;
ParsePath(svReturnString, TARGETDIR, PATH);
szMsg = "Installation Path has been updated:\n\n %s";
SprintfBox (INFORMATION, "Target Drive" , szMsg, svReturnString);

bDone = TRUE;

endswitch;

endwhile;

// get the end user's selection, and display it in a message box
// MessageBox("You selected drive " + svDrive, INFORMATION);


ListDestroy(listDrives);
EndDialog("ChangeDrive");
ReleaseDialog("ChangeDrive");

return nReturn;
end;


I was also trying to figure a way to set the selection to the current drive used in TARGETDIR, but with no luck yet.
0 Kudos
jchristman
Level 8

I found the notes on GETValidDrivesList and have changed the syntex to be

GetValidDrivesList(listDrives,FIXED_DRIVE,200000);

Thank you for help.
0 Kudos