PDA

View Full Version : Let user select Drive



Chris
06-10-2012, 05:53 AM
I have several things I can't get to work in SetupBuilder, but rather than spend time on those I will explain what I am trying to do and you can probably tell a better way.

I want to display a dialog asking user which Drive Letter they want to install onto. And to validate their entry to check it is a local harddrive on this PC.

linder
06-10-2012, 06:09 AM
Chris,

I would suggest to download the very nice "Learning SetupBuilder Part I" and the "Examples Package".

You have several different options. For example, see the "Combo Box 2.sb7" demo project.

Does this help?

Friedrich

Chris
06-10-2012, 06:47 AM
Many thanks, that looks perfect.

I had already gone through the learning SetUpBuilder and many of the examples, but did not look at the comboBox example as it was not a ComboBox I thought I needed :-)

I appreciate the quick reply.

linder
06-10-2012, 06:48 AM
You are welcome :)

Friedrich

Chris
06-10-2012, 07:14 AM
Is there any more information about Enumerate Disk Drives?
(yes, I have just searched the help PDF etc).

For example, does it include mapped drives? either network drives mapped as drive letter, or folder on local drive mapped as drive letter? Does it include USB Drives currently plugged into the PC?


Using Set Variable %COMBOBOXTEXT% to FUNCTION :Get System Info (Enumerate Disk Drives)
create %COMBOBOXTEXT% as some strange variable, and Dialog (Combo Box) seems to know how to handle this variable and extract the required data from it.

But if I try and look at this variable, eg
If %COMBOBOXTEXT% Contains "C"
then this test fails (though %COMBOBOXTEXT% does contain "C:|D:| etc"

So can you point me to a bit more information about this.

(Sorry for asking about something that does work, it's just that I hate using things I don't understand :-)

linder
06-10-2012, 07:41 AM
Enumerate Disk Drives—Fills a list with strings that specify valid drives in the system.

That means the variable holds all (known) available drives (mapped drives, USB, etc.).

Here is a simple demo:

www.lindersoft.com/projects/Drives.zip

It 1.) displays all available drives in a combo box and 2.) lets the user enter a drive letter. It then checks if the entered drive letter is in the list of available drives (not related to the selected drive from the combo in this example).

Friedrich

Chris
06-10-2012, 11:31 AM
Thank you. Your example works.

I had done similar, getting all drives into %ALL% and user input into %U%
And then show a message box with: Value of ALL = %ALL% >>>>> shows A:|C:|D:|E:
Value of U = %U% >>>>> shows C

But If %ALL% Contains %U% Then
does not work. ie. it think ALL does not contain C.

Since my script appears identical to yours, I am still puzzling why yours works and mine does not....

Chris
06-10-2012, 11:41 AM
Please ignore my previous message.
<NOW SOLVED>

(The % % were missing). Sorry.

linder
06-10-2012, 11:43 PM
:)

Friedrich

Chris
06-11-2012, 04:52 AM
This (hopefully) is final question on this subject.

If I share a folder on my local hard drive and then map it as a drive letter, GET SYSTEM INFO will show this as $DRIVE_REMOTE$

So to allow user to choose install onto this mapped drive (I have reason :-( or onto local hard drive root, I have to let them choose from drive types
$DRIVE_FIXED$ AND $DRIVE_REMOTE$.

Question: Is there any simple way to check if this Remote drive (mapped drive) is actually located on the local PC. And, if the remote drive is a $DRIVE_FIXED$ ?

linder
06-11-2012, 05:13 AM
First of all, please read the following (so you are prepared if your mapped drive scenario causes problems):

http://www.lindersoft.com/forums/showthread.php?t=31410

Unfortunately, I don't know any simple way to check if a remote drive is located on the local machine.

Friedrich

Chris
06-11-2012, 05:27 AM
Here is what I have done so far.
If drive is REMOTE then compare its FREE SPACE with the FREE SPACE on Drive C and Drive D. And if SPACE is equal, then I assume the remote drive is on local PC.

Before you say it, yes I know this is horrible.

linder
06-11-2012, 05:37 AM
Just curious, why do you have to do this at all <g>?

Friedrich

Chris
06-11-2012, 01:40 PM
Historic reasons. Old installer would only install onto drive letter. Windows7 doesn't like anyone sharing the root directory of a drive. Quick fix was to share a folder and then map it as a drive letter. Manuals written describing this. My installation looks for existing app and if found offers to Update it rather than install new. So to start with I am just recreating all the installations using SetUpBuilder. THEN I will look at redesigning the whole thing.
I bet you are sorry you asked <g>

linder
06-11-2012, 11:52 PM
Aha, okay. I understand :)

Friedrich