Write APPDIR to text file and display when install is done - 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!

bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Write APPDIR to text file and display when install is done

We recently purchased Advanced Installer and I'm still learning how to use it so please pardon what may seem like an obvious question. During my install, I need to write some information to text file and then display that text file to the user when the install has completed. I've figured out how to display the text file but I'm not sure how to write the directory name to the text file during the installation process. My file layout looks like this:

\myapp.exe
\x86
\x64

So if APPDIR is "Program Files (x86)\MyCompany\MyApp", then during my installation, I need to determine if the OS is x86 or x64 and then write APPDIR\x86 or APPDIR\x64 to my text file which I'll show to the user when the installation is complete. Can anyone tell me if that's possible and if so, how to do it? Thanks.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write APPDIR to text file and display when install is do

Hello,

In order to achieve what you want you can use our "Text File Updates" feature. Here's the steps to proceed:
- Go to "Files and Folders" page and create the related "x86" and "x64" folders.
- In the "x86" folder add a new text file update (i.e. YourFile.txt) using the [New Text File Update] toolbar button. In the "Edit Text File Update Dialog" select the "Append/Create Operation" and add the following content:
  • [x86_Dir]
which is the "x86" folder property.
- In the "x64" folder add a new text file update (i.e. YourFile.txt) using the [New Text File Update] toolbar button. In the "Edit Text File Update Dialog" select the "Append/Create Operation" and add the following content:
  • [x64_Dir]
which is the "x64" folder property.
- Go to "Organization" page, select the component of your x86 text file and in the "Condition" field, from "Component Properties" right pane, add the following condition:
  • Condition: (NOT VersionNT64)
- Select the component of your x64 text file and in the "Condition" field, from "Component Properties" right pane, add the following condition:
  • Condition: VersionNT64
- Go to "Custom Actions" page and add two "Launch file or open URL" custom action with sequence, after "Install Execution Stage -> Finish Execution" action group, like this:
  • Command: notepad [x86_Dir]YourFile.txt
    Condition: (NOT VersionNT64)

    Command: notepad [x64_Dir]YourFile.txt
    Condition: VersionNT64
- Build and run your project.

Also, here's attached a sample created using version 9.6 of Advanced Installer which implements a similar approach.
sample.zip
(3.08 KiB) Downloaded 372 times
Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
bmt22033
Posts: 21
Joined: Tue Jun 26, 2012 2:14 pm

Re: Write APPDIR to text file and display when install is do

Hi Daniel. Thank you very much for the detailed reply. That (nearly) works perfectly for me! ;-) I say nearly because for some reason, the contents of my YourFile.txt seem to be getting written twice. In the "Edit Text File Update" dialog, I have confirmed that the "If the file exists append content" is not checked. I have also run the "Uninstall Cleanup" wizard to make sure that my text file is getting removed when the application is uninstalled. The content of my Text File Update looks like this:

The driver directory is [x86_Dir].

But after my installer has run and the custom action displays the text file, it contains:


The driver directory is c:\Program Files (x86)\MyCompany\MyApp\x86.
The driver directory is c:\Program Files (x86)\MyCompany\MyApp\x86.

So it seems like the text file update is happening twice but I'm not sure why. Any thoughts on what might be causing this behavior?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Write APPDIR to text file and display when install is do

Hello,

I'm not sure why you are encountering this behavior. Can you attach a sample reproducing the behavior or can you give us more details about your scenario (maybe exemplify) so we can try to reproduce the behavior?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”