TargetDir variable problem

Got a problem you cannot solve? Try here.
Doron
Posts: 20
Joined: Mon Nov 27, 2006 4:36 pm
Location: USA

TargetDir variable problem

Postby Doron » Fri Feb 16, 2007 6:08 pm

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

jimo
Posts: 342
Joined: Fri Aug 19, 2005 10:59 am
Location: Atlanta, GA
Contact:

Postby jimo » Mon Feb 19, 2007 4:54 pm

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.
Jim Oswell
Software Engineering Manager, Dental
Greenway Health, LLC
http://greenwaymedical.com

Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Postby Edhy » Mon Feb 19, 2007 11:37 pm

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
Edhy Rijo
Thom Child and Family Services

Doron
Posts: 20
Joined: Mon Nov 27, 2006 4:36 pm
Location: USA

TARGETDIR PROBLEM with Destination dialog box

Postby Doron » Wed Feb 21, 2007 12:47 pm

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

Immelman
Posts: 14
Joined: Thu Jan 11, 2007 4:15 am

Target dir checking

Postby Immelman » Tue Feb 27, 2007 5:25 am

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.

neillans
Posts: 536
Joined: Sat Nov 04, 2006 6:21 am
Location: Scottish Borders, UK
Contact:

Postby neillans » Tue Feb 27, 2007 7:36 am

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 :)
Andy Neillans

Immelman
Posts: 14
Joined: Thu Jan 11, 2007 4:15 am

Example of validating MSI script

Postby Immelman » Tue Feb 27, 2007 8:32 am

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]

neillans
Posts: 536
Joined: Sat Nov 04, 2006 6:21 am
Location: Scottish Borders, UK
Contact:

Postby neillans » Tue Feb 27, 2007 8:54 am

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

Andy Neillans

Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Re: TargetDir variable problem

Postby Edhy » Tue Feb 27, 2007 12:21 pm

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
Edhy Rijo
Thom Child and Family Services

neillans
Posts: 536
Joined: Sat Nov 04, 2006 6:21 am
Location: Scottish Borders, UK
Contact:

Postby neillans » Thu Mar 01, 2007 4:32 am

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.
Andy Neillans

Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Postby Edhy » Thu Mar 01, 2007 9:20 am

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:
Edhy Rijo
Thom Child and Family Services

neillans
Posts: 536
Joined: Sat Nov 04, 2006 6:21 am
Location: Scottish Borders, UK
Contact:

Postby neillans » Thu Mar 01, 2007 4:47 pm

Have a look at the attached; hope it does what you are after :)

File Attached:

Install Drive.zip
Andy Neillans

Edhy
Posts: 138
Joined: Sun Jul 31, 2005 4:09 pm
Location: New York, USA

Postby Edhy » Fri Mar 02, 2007 12:17 am

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
Edhy Rijo
Thom Child and Family Services


Return to “Technical Support”

Who is online

Users browsing this forum: No registered users and 58 guests