HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Silent install and "Display Message Box" output property

Hi,

I have an installer asking the user a YesNo Message Box as custom action before uninstall. The output property is BTN_PRESSED and
the default button is the second one.
Now i want to uninstall my installer silently but my BTN_PRESSED="IDYES" at commandline has no effect.
What do I wrong?

Code: Select all

start /wait myInstaller.exe /exenoui /qn /x BTN_PRESSED="IDYES"
AI: 11.9

Thanks for help,
BR,
Hendrik
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik and welcome to our forums,

I am not quite sure what you mean by this:
Now i want to uninstall my installer silently but my BTN_PRESSED="IDYES" at commandline has no effect.
Could you please give me some more details about what exactly is not working?

Regarding the used command, I believe it may not be correct. Could you please try a command line as it follows:

Code: Select all

setup.exe /x // /qn BTN_PRESSED="IDYES"
and let me know if it works as exepcted?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,

I attached a pic showing what is done, when the user interface is involved.
This message is shown to the user, if it is uninstalled by UI.
Now I want to uninstall it by console but I cannot get it working to set the correct property for the display box
or at least it does not work for some reason.
Basically this message box holds certain directories after uninstall if "YES" is chosen.
This "YES" option should be set by command line.

Unfortunately your solution does not work either.
I hope it is a bit clearer now what I want to achieve.
Thanks,
BR,
Hendrik
Attachments
Untitled.png
Untitled.png (50.9 KiB) Viewed 9358 times
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,

Thank you for your followup on this!

It looks like I have understood the scenario right.

I have run a new test right now and everything worked as expected on my end.

Please find attached the sample .AIP file I have used in my test:
Your Application.aip
(16.87 KiB) Downloaded 331 times

The command line I have used is the one I have mentioned above:

Code: Select all

setup.exe /x // /qn BTN_PRESSED="IDYES"
If I run the above command line, the message box is not displayed at all.

In order for me to further investigate this, could you please create a sample project that reproduces this and forward it to me - either here or by e-mail at support at advancedinstaller dot com?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,

hmm I cannot run the aip because I only have a professional version.
Nevertheless, the message box is not displayed at all in my case which is correct.
What I want is that the BTN_PRESSED property is populated from console to the custom action i.e.
can you make an example where you propagate the BTN_PRESSED value from console through the message box to a certain action e.g. create a file on "Yes" otherwise do nothing?

Thanks,
BR,
Hendrik
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,
can you make an example where you propagate the BTN_PRESSED value from console through the message box to a certain action e.g. create a file on "Yes" otherwise do nothing?
Sure thing! Please find attached a sample project:
Hendrik Sample Project.aip
(18.49 KiB) Downloaded 319 times
Beside the messagebox custom action, the above project has a PowerShell script custom action that will only execute if the BTN_PRESSED property has a value of "IDYES".

As mentioned above, the command line would look something as it follows:

Code: Select all

setup.exe /x // /qn BTN_PRESSED="IDYES"
Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,

thanks for the sample. This is basically what I would expect yes.
In my special case a folder should not be deleted if YES is chosen.
I attached a screenshot for the operations. The condition looks similar to yours but nevertheless it is not working.
The folder is deleted anyway. Is there another option I have to chose here for silent uninstall?

BR,
Hendrik
Attachments
Untitled.png
Untitled.png (111.65 KiB) Viewed 9280 times
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,

Thank you for your followup on this, I believe I understand your scenario now.

I believe you misunderstood some things here, therefore please allow me to try and help.

First of all, please note that, during an uninstall, all the folders (and files) created by your setup will be removed, "Application Folder" also being included.

With that being said, you do not need to enable the "Remove folder" option for it.

Now, if you do not want to remove the folder on uninstall based on your messagebox, you could use the "Do not overwrite existing files" option, for the same folder. You can condition this based on the BTN_PRESSED property.

Now, let me explain what that "Remove folder" option is for. We've said earlier that, by default, during an uninstall all the files and folders created by the setup will be removed - this is the default behavior of Windows Installer.

So, the only option left here would be the folders created outside of the installation process. When you run the installation, there is no way Windows Installer will know of objects created outside of the process.

For instance, an example here would be an EXE file that you deliver. When this EXE runs, it creates a new folder on disk where it stores its' log files.

If you would want that folder removed during an uninstall, you would need to recreate the folder structure in the "Files and Folders" page and check the "Remove folder" option for your folder.

Hope things are clearer now!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,

well yes I used this option to remove folders being created while running the application. I also have the option.
But the BTN_PRESSED option is not propagated obviously.
I attached the condition as well.
BR,
Hendrik
Attachments
Untitled.png
Untitled.png (45.9 KiB) Viewed 9249 times
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,

As I have mentioned earlier:
First of all, please note that, during an uninstall, all the folders (and files) created by your setup will be removed, "Application Folder" also being included.
In your case, the "USER_DATA_Path" folder is created by the setup, therefore it will be removed upon uninstall. With that in mind, please note that you do not need to check the "Remove folder" option, as the folder will be removed anyway.

Now, regarding your condition, we are complicating things there. Please use only the BTN_PRESSED = "IDYES" condition, as the rest is not necessary.

Hope this will help!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,

i use the remove option because there are folders created by the application itself. Otherwise it will be not deleted.
If I only use the BTN_PRESSED option, it is still not working.
If I uninstall by UI, everything works as expected. Only by cmd something seems to be wrong.
Can you reproduce this behavior by creating a project and do the following:
  • Message Box which asks the user if all dirs should be deleted on uninstall process
  • After installing, create a sample directory in the install directory
  • Then uninstall if the message box works
  • Reinstall and check if the uninstall cmd works
BR,
Hendrik
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,

I have followed the steps and it worked as expected on my end.

Please find attached below a sample project which you can also test on your end:
Hendrik Sample.zip
(4.24 KiB) Downloaded 339 times

The property based folder "TEST_FOLDER" will create the following folder on disk:

C:\test

Here are the steps:

- install the setup

- under C:\test create a new folder (as per your request)

- open an elevated command prompt and run the setup as it follows:

Code: Select all

setup.exe /x // /qn BTN_PRESSED="IDYES"
When doing so, the folder and its' subfolders will be removed.

If you repeat the steps and use BTN_PRESSED="IDNO", the folder will remain on disk, together with the subfolder we have manually created to emulate the behavior of your application.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
HendrikF
Posts: 7
Joined: Wed May 19, 2021 10:02 am

Re: Silent install and "Display Message Box" output property

Hi Catalin,
thanks for the sample.
This is exactly what I want to have but this is basically the same as I have.
Why is this not working in my case?
Is it useful for you to get my aip file for Analysis?

BR,
Hendrik
Catalin
Posts: 6584
Joined: Wed Jun 13, 2018 7:49 am

Re: Silent install and "Display Message Box" output property

Hello Hendrik,

This is quite strange, indeed. I can not say for sure why this is not working on your end.

Yes, please send me the following resources:

- a copy of your .AIP file

- a download link for the setup

by e-mail at support at advancedinstaller dot com so I can further investigate them.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”