tiffanym
Posts: 8
Joined: Tue Aug 31, 2021 6:48 pm

Use Existing User Environment Variables

Fri Dec 17, 2021 9:15 pm

Hello,

I'm looking to use/access existing user variables to install a file to.

We tell users to set the the user environment variable PYTHONHOME to a path for our install.

I would like to then use PYTHONHOME in my Advanced Installer project to know to install a file there.

I tried following #3 of these steps: https://www.advancedinstaller.com/user- ... er-profile

Under the Files and Folder, I created a new Folder, property based. I set the "Name" to "PYTHONHOME". The article then says to leave the "Default Value" as none, but that's not an option. I've tried specifying it to "PYTHONHOME", "%PYTHONHOME%", "[%PYTHONHOME]","none", etc.
Property.png
Property.png (16.17KiB)Viewed 3271 times
I added my file to the PYTHONHOME directory in the Files and Folders section.
FilesFolders.png
FilesFolders.png (21.72KiB)Viewed 3271 times
I went on to also do the following steps under "Custom Actions":
"Set installer property"
Property: PYTHONHOME
Value: [%PYTHONHOME]
PropertySet.png
PropertySet.png (69.75KiB)Viewed 3271 times
But regardless whatever I set the the "Default value" to when specifying the property, I get "Could not access network location PYTHONHOME" during the install (while computing space requirements). How can I access an existing environment variable on install?

I've also got a powershell script and if there's a programmatic way to do it there, I'd be happy to try.

Thanks,

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Use Existing User Environment Variables

Mon Dec 20, 2021 11:43 am

Hello,
The article then says to leave the "Default Value" as none, but that's not an option. I've tried specifying it to "PYTHONHOME", "%PYTHONHOME%", "[%PYTHONHOME]","none", etc.
Normally, you can not create an empty property.

However, to achieve that in Advanced Installer, you can leave the "Value" field empty and add a comment in the "Comment" field.

Regarding the encountered issue, you probably receive the message because the property is not yet set during the "CostFinalize" action.

CostFinalize - ends the disk space costing and resolves the folders in the project.

This action is part of the "Paths Resolution" action group. As you can see, that is also executed under the "Wizard Dialogs Stage".

With that in mind, could you please try to schedule the "Set property" custom action before the "Paths Resolution" action group, under the "Wizard Dialogs Stage" and let me know if it works?

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

tiffanym
Posts: 8
Joined: Tue Aug 31, 2021 6:48 pm

Re: Use Existing User Environment Variables

Mon Dec 20, 2021 5:21 pm

Hello,

Thank you so much for that! I was able to leave the value blank, and add a comment and the build/install worked as I was expecting!

Thank you!

Catalin
Posts: 6542
Joined: Wed Jun 13, 2018 7:49 am

Re: Use Existing User Environment Variables

Tue Dec 21, 2021 5:11 pm

You are always welcome!

Glad I could help.

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

Return to “Building Installers”