Page 1 of 1

TargetDir variable problem

Posted: Fri Feb 16, 2007 6:08 pm
by Doron
Hi Mike,

I did not get any reply before so I am hoping that I can see something coming.<S>

I am trying to let the user to choose a different drive but still keep the installation folder. So I copied the Destination dialog to a new name and added a drop down list that will allow the user to select only a different drive.

For the Drop Down List I have the following:
The Receives Information says: Installation Folder
Write value to Variable is empty.

The Problem is that the TargetDir variable can not be updated via the combo box and it needs to be displayed into the Folder Text control where Enabled is False.

The strange thing that my friend is using the same dialog box with the combo and in his computer it works.

How can I make the TargetDir memvar to be updated when ever the combo box change the drive and not to loose the installation folder name?

Like to change the drive so it will be as: D:\\ABC9 and not only as D:\\
It works fine when ever I select Drive C via the combo and it is C:\\ABC9

To set up the TargetDir I do as follows:
SET Variable TARGETDIR TO $BootDrive$$MAIN_PROJECT_NAME$


Thanks,

Doron

Posted: Mon Feb 19, 2007 4:54 pm
by jimo
Doron,
I get exactly the same results you do, which is by design the way it is suppose to wrk, I would love to see the code from your friends script posted here.

Posted: Mon Feb 19, 2007 11:37 pm
by Edhy
Hi Jimo,

If this approach is by design, what would be the correct IA way to get this kind of feature where the Installation Folder is setup by default by the developer and the End User should only be able to change the Installation Drive?

Thanks!

Edhy Rijo

TARGETDIR PROBLEM with Destination dialog box

Posted: Wed Feb 21, 2007 12:47 pm
by Doron
Hi Jim,

I have the same Destination dialog box that my friend has and even copied his project to my computer and running his project all works fine. So I was changing what ever possible based on his scrip and still it does not work on my project.

So I can not provide you a definite answer yet. I was hoping that InstallAware will provide such a basic feature build in since when I was using Wise Installation it was pretty easy to do. So why IA do not intervene in here???

Regards,

Doron

Target dir checking

Posted: Tue Feb 27, 2007 5:25 am
by Immelman
Is it possible to check if the Target dir in the destination exists before continuing the installation?

If I enter an illegal file path in the destination dialog’s file path i.e. (non-existing file, file path with illegal chars %, $, &, etc.) the installation continues and to install the files to the program files directory on my computer.

If I delete the destination drive letter the setup also continues up and till the point where it gives me the following error: “Could not access network location: (Incorrect file path)”

I want the user to be able to type or browse to the installation destination of his/her choice. Then I want to check if the filename provided exits and is valid.

Posted: Tue Feb 27, 2007 7:36 am
by neillans
You can add validation routines as needed via MSI Code if you wish.

I'll see if I can add built-in validation to the wish list :)

Example of validating MSI script

Posted: Tue Feb 27, 2007 8:32 am
by Immelman
Could you please give an example of path validating MSI script?

I was kind of hoping to insert the "Does file/ folder exist" into my MSI script but I dont know where to insert it so that the string value that gets inserted by the user into the textbox object on the destination dialog gets evaluated when the next button is clicked.

In my setup the only mention of the TARGETDIR variable in the MSI code is in the "Setup User Interview" Region.[/quote]

Posted: Tue Feb 27, 2007 8:54 am
by neillans
If you have a look through your script, you should have a section that includes

Code: Select all

label: Destination Directory

If you add your validitation code in the following if block - for example:

Code: Select all

label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Custom Setup
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
// Add your validation code here. If it fails, goto label Destination Directory.
end


So, something like this should do the job (untested!):

Code: Select all

label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
  GoTo Label: Custom Setup
  else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
  Set Variable TARGETEXISTS to FALSE
  Does Folder Exist $TARGETDIR$ (get result into variable TARGETEXISTS)
  if Variable TARGETEXISTS Equals FALSE
    GoTo Label: Destination Directory
  end
end


Re: TargetDir variable problem

Posted: Tue Feb 27, 2007 12:21 pm
by Edhy
Hi Andy Neillans

Glad to see someone from IA here.

How can we force an installation to install in a predifine folder like "MyApplicationFolder"" and just allow the user to change the drive?

Please take a look at the quote below for more info.

Doron wrote:Hi Mike,

I did not get any reply before so I am hoping that I can see something coming.<S>

I am trying to let the user to choose a different drive but still keep the installation folder. So I copied the Destination dialog to a new name and added a drop down list that will allow the user to select only a different drive.

For the Drop Down List I have the following:
The Receives Information says: Installation Folder
Write value to Variable is empty.

The Problem is that the TargetDir variable can not be updated via the combo box and it needs to be displayed into the Folder Text control where Enabled is False.

The strange thing that my friend is using the same dialog box with the combo and in his computer it works.

How can I make the TargetDir memvar to be updated when ever the combo box change the drive and not to loose the installation folder name?

Like to change the drive so it will be as: D:\\ABC9 and not only as D:\\
It works fine when ever I select Drive C via the combo and it is C:\\ABC9

To set up the TargetDir I do as follows:
SET Variable TARGETDIR TO $BootDrive$$MAIN_PROJECT_NAME$


Thanks,

Doron

Posted: Thu Mar 01, 2007 4:32 am
by neillans
Sure :)

You would need to modify the "destination" dialog, and remove the text control (or make it readonly).

Drop a "DriveComboBox" from the Browser tab in the Dialog Editor, and set it to save the drive letter out to a variable.

Then, in your code, you would need to strip the drive letter of the original target path (before loading the dialog), and add the new target drive letter after the dialog closed.

That should do what you are after :)
If I get time, I will create an example project of this.

Posted: Thu Mar 01, 2007 9:20 am
by Edhy
Hi Andy,

Thanks a lot for this info, I had try something like that.

I would really appreciate if you could take the time to drop me a sample code. :roll:

Posted: Thu Mar 01, 2007 4:47 pm
by neillans
Have a look at the attached; hope it does what you are after :)

File Attached:

Install Drive.zip

Posted: Fri Mar 02, 2007 12:17 am
by Edhy
Hi Andy,

Thanks a lot for taking the time to provide the sample code, it did help greatly.

I had to fix the TARGETDIR value with the selected drive from the combo, the original line153 is:

Code: Select all

SET Variable TARGETDIR to $DRIVES\\$PATH$

And I changed to:

Code: Select all

SET Variable TARGETDIR to $TARGETDRIVES\\$PATH$

Which is obviously a keyboard mistake, but the important thing is that your approach does work :D