Validating a typed in path

Got a problem you cannot solve? Try here.
Ryan Lee
Posts: 26
Joined: Fri Jun 29, 2007 7:11 pm

Validating a typed in path

Postby Ryan Lee » Fri Jun 29, 2007 7:20 pm

Hello,

I have a dialog with a push button and a edit box. The edit box is populated with a variable that is initially set to the default installation directory. When the button is pushed, I perform a select custom folder and change the value in the edit box to whatever directory the user selected. The edit box is enabled so the user can type in the directory without having to use the folder selector.

Is it possible to validate the contents of the dialog to make sure the typed in path is valid? When dealing with Wix this is possible by specifying the CheckTargetPath control event. Is anything like this possible with InstallAware?

Thanks in advance for any help.

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

Postby jimo » Sat Jun 30, 2007 6:53 am

Try:

Code: Select all

Set Variable CHECKFOLDER to FALSE
Set Variable USERFOLDERCHOICE to $TARGETDIR$
label: Destination Directory
Display Dialog: destination, wait for dialog to return (modal)
if Variable WIZARD Equals BACK
   GoTo Label: <Previoous>
else
  if Variable WIZARD Equals CANCEL
    GoTo Label: Main Install
  end
end
Does Folder Exist $USERFOLDERCHOICE$ (get result into variable CHECKFOLDER)
If Variable CHECKFOLDER Equals FALSE
     GoTo Label: Destination Directory
end
Jim Oswell
Software Engineering Manager, Dental
Greenway Health, LLC
http://greenwaymedical.com

Ryan Lee
Posts: 26
Joined: Fri Jun 29, 2007 7:11 pm

Postby Ryan Lee » Tue Jul 03, 2007 4:16 pm

Thanks for the response. Unfortunately, the user is able to type in a folder that doesn't currently exist. The directory may be created at a later point in the installation. The File/Folder Exist command will probably be insufficient. Is there some way to see if the types in directory is valid (eg: doesn't contain invalid characters, valid disk drive, etc) ??

Thanks,
Ryan

seanc
Posts: 3
Joined: Wed Mar 28, 2007 1:52 am

Postby seanc » Thu Jul 12, 2007 9:40 pm

Is there a way to access the Remaining Space value that is returned from the Browse folder code?

If you put in an invalid TARGETDIR the RemainingSpace text box will show a negative value.

That is the value that Ryan & I are trying to catch to display an error like:
Invalid Destination Directory

Creating the directory is not what should be done because it is just another thing to be cleaned up.
Sean


Return to “Technical Support”

Who is online

Users browsing this forum: Bing [Bot] and 74 guests