Check for a file in browsed directory before installing. - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

CuteWorm
Posts: 2
Joined: Wed Dec 23, 2009 12:42 pm

Check for a file in browsed directory before installing.

Hi, I'm new here.

I'm using Enterprise project type.

I have an installation file that has a set of prerequisites rules for launch. (Higher than Windows XP only).

I'm creating an add-on/plug-in for an existing software.
I'm letting the users to browse to their software directory as the software itself is extracted, not installed. (It comes in a zipped archive.)
So it can be anywhere on the user's system.

So, I would like to do a prerequisite check, just in case users browsed to the wrong directory.
Next button is currently disabled. It will only be enabled if mapeditor.exe is found in browsed path.
How do I go about doing it?
  • I've tried using Search under Project Settings. But Search will happen before the user browse to the path.
    Same goes for Prerequisites launch.

    I've also tried editing the dialog options and creating a control condition on the Next button.
    But the closest I can get is a Folder operand. I've tried [APPDIR]mapeditor.exe but it doesn't work.
    Is there a File operand? Am I on the right track? Or what should I put in control condition?
Thanks beforehand and I would sincerely appreciate any help.
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Check for a file in browsed directory before installing.

Hi,

Currently this is not supported directly by Advanced Installer. However, you can try this approach:
- create an UI custom action which determines if the file exists (you can get the installation path from the APPDIR property)
- add this custom action as a DoAction control event on the "Next" button of the "FolderDlg" dialog
- the custom action can set an installer property according to the search result
- this property can be used to condition a message box and the "NewDialog" control event which shows the next dialog; perhaps this how-to will help you

A future version of Advanced Installer will include a predefined custom action and a how-to for this.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
CuteWorm
Posts: 2
Joined: Wed Dec 23, 2009 12:42 pm

Re: Check for a file in browsed directory before installing.

Thanks cosmin.

But I'm a rather newbie in the UI Custom Action.
Can you further guide me on how to determine if the file exists? Do I use Script Inline function?

I know that [APPDIR] refers to the directory the user has browsed.
But I'm unsure of the programming syntax.

Can I use mapeditor.exe isin APPDIR or is there even such a validation?

Looking forward to your wonderful help again. =)
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Re: Check for a file in browsed directory before installing.

Hi,
Can you further guide me on how to determine if the file exists?
I'm afraid we don't have sample code for this, but you can use any Win32 custom action which has access to the MSI handle. For example, you can use a VBScript or a C++ DLL. We have a sample C++ DLL custom action which may help you.
Do I use Script Inline function?
A Script Inline custom action can run VBScript code and it's usually used for one line of code. Since you need to determine if the file exists and then set an installer property, you need more than one line. If you use VBScript you can write the code in a .VBS file. VBS and C++ DLL files can be added as New Attached Custom Actions.

Regards,
Cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”