PetLahev
Posts: 5
Joined: Tue Jul 28, 2015 9:37 pm

Installing to property based folder vs. default

Hello

I'd like to ask for an advice. I'm building an installer for VBA project (MS Word) and need to insert some files to MS Word Startup folder.
This folder is usually (understand default) located at

Code: Select all

%AppData%Microsoft\Word\STARTUP
but user is free to change it as needed, in this case a new entry will be inserted in registry. I need to prepare for both situations (default folder or custom folder)

So far I figured out that I need use registry search for checking

Code: Select all

HKEY_CURRENT_USER\Software\Microsoft\Office\16.0\Word\Options 
(the value is called STARTUP-PATH)
16.0 - means Word 2016
because I need to check versions from 2007 to 2016 I believe I need to setup 4 searches (12.0,14.0,15.0,16.0), am I right?
If any of the searches return a value (a path) then, I think, I need to use property based folders to be able to install the files to the custom Startup folder. So far I think I know how to do that but here is the main question.

When the above searches didn't return any value, it means the user uses the default path. How can I prepare for it? I believe I need some sort of

Code: Select all

IF
to decide if to use the property based folder or the default path? Or what would you do in this situation?

Thanks in advance
Premysl
Dan
Posts: 4513
Joined: Wed Apr 24, 2013 3:51 pm

Re: Installing to property based folder vs. default

Hi Premysl and welcome to Advanced Installer forums,
because I need to check versions from 2007 to 2016 I believe I need to setup 4 searches (12.0,14.0,15.0,16.0), am I right?
Indeed, you need to create a search operation for each version of Office to check the STARTUP-PATH.
When the above searches didn't return any value, it means the user uses the default path. How can I prepare for it? I believe I need some sort of

Code: Select all

IF
to decide if to use the property based folder or the default path? Or what would you do in this situation?
I would recommend you to use different properties name for search operations and property based folders and through a set installer property custom action set the property assigned to the property-based folder with the value of the search operation.

You can configure the custom actions as in the attached image.
SetOffice2007StartupFolder.png
SetOffice2007StartupFolder.png (44.75 KiB) Viewed 3054 times
Basically, conditionally setting different properties for property based folders based on the search result will ensure the IF statement.

Let me know if you have other questions.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
PetLahev
Posts: 5
Joined: Tue Jul 28, 2015 9:37 pm

Re: Installing to property based folder vs. default

Thanks a milion Dan!

Sorry it took that long to respond I went through a few failing attempts but I believe I've finally figured it out.
For anyone looking at the same problem here are a few pictures
Registry search.png
Registry search.png (75.17 KiB) Viewed 3029 times
Set installer property.png
Set installer property.png (90.57 KiB) Viewed 3029 times
Property based folder.png
Property based folder.png (31.44 KiB) Viewed 3029 times
So the steps are like this (I have done just setting for one Office version, will have to repeat for all)
1, Registry search is performed for all office version (for some reason I couldn't upload picture but it's simple like below)
Key: Software\Microsoft\Office\16.0\Word\Options
Name: STARTUP_PATH
2, In the custom action called - SetOffice2016StartupFolder - the value of the above search is inserted into the DEFAULT_WORD_STARTUP_FOLDER property only if it returns any value (the first picture)
3, In the custom action called - SetOfficeDefaultStartupFolder - it checks if the registry search return any value and if not, will setup the default path (the second picture)
4, Finally at the property based folder I use the chosen path to install my files

Thanks again Dan, really appreciated
Pat
Daniel
Posts: 8238
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Installing to property based folder vs. default

Thank you for your detailed feedback on this Pat.

I'm sure your detailed solution will be useful for future users.

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

Return to “Building Installers”