sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Advanced Installer Predictable Directory

Hi All,

This is a request for AI itself, not the installers it builds. I apologize if it already exists and I missed it but I looked and haven't been able to find it.

I have several scripts set up to build a group of installers that we have using PowerShell. It really just loops through all the ones I need to build and calls AI via the command line with parameters and works just fine. However, It needs the path to advancedinstaller.com, which means I either need to put that path in the script itself or put it in my path variable so that PS can recognize it there. Either way, the issue is that whenever you install a new version of AI it has the version number in the path so it changes. That means I either need to change all my scripts to the updated path or change my path variable in environment variables accordingly. The path environment variable I think is the better way to go here, and it's not a huge deal if that's what I need to do, but it's annoying to have to change it every time.

Is there a way to either have AI install to a consistent path so that I can use it from the same location consistently regardless of my version, or can it add it's install directory to the Path environment variable automatically so that it will be recognized?
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

Hello Stephan,

Starting with version 22.0, we have added a predefined env variable that points to the latest version of Advanced Installer.

The name of the variable is ADVINST_COM.
Screenshot_12.png
Screenshot_12.png (20.57 KiB) Viewed 4937 times
Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

Oh awesome, that should work, thank you! I missed that update I guess.
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

Ok so additional question on this after trying it. I was able to get the environment variable and update. Here is my PowerShell code:

Code: Select all

	$installerPath = $env:ADVINST_COM
	for ($year = 2023; $year -le 2026; $year++) {
		& $installerPath /rebuild "*my relative path*"
	}
When I run this, it gives me this error:

Code: Select all

& : The term '"C:\Program Files (x86)\Caphyon\Advanced Installer 22.6\bin\x86\AdvancedInstaller.com"' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or 
if a path was included, verify that the path is correct and try again.
At C:\Users\fauss\source\repos\BIM-Interop-Tools\InstallerPipeline.ps1:61 char:5
+         & $installerPath /rebuild "Installers\AIT $year.aip"
+           ~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ("C:\Program Fil...dInstaller.com":String) [], CommandNotFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
It looks like it's not found, but I went to the path directly and verified that it's there. Also when I add the first part of the path to the windows PATH variable and then just change

Code: Select all

& $installerPath
to

Code: Select all

advancedinstaller.com
it works.

Any tips on how to make this work right with the environment variable?
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

Hello Stephan,

Powershell does not work exactly like CMD, and therefore you can not launch an EXE package just by typing its' path there.

Instead, we have to use the start-process cmdlet, like this:

Code: Select all

start-process $installerPath -ArgumentList "/build `"C:\Users\Catalin\Desktop\Your Application.aip`""
Note the tilda character I'm using to escape the quotes from inside the quotes.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

Ok but that starts it in a separate process and doesn't wait for it to complete. The script is intended to build the installers and then copy them to a single location. If I use that then it's trying to copy before the build is done and doesn't work...
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

Hello Stephan,

Please note that the start-process cmdlet has a parameter named "wait" that does exactly what you need, waits for the process.
Screenshot_13.png
Screenshot_13.png (17.12 KiB) Viewed 2927 times

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

Ah, I hadn't seen that thank you! Sorry fairly new to Powershell still.
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

Hello Stephan,

You are always welcome! :)

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

That is working great so thank you again. As long as we are on the subject....

I also have a task bar shortcut for AI and that has to be redone with each new version. I tried making a shortcut with this environment variable but it won't work with the com file. Any chance you could also make a variable for the exe file? Or another way to have a consistent task bar shortcut?
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

Hello Stephan
That is working great so thank you again.
You are always welcome!
I also have a task bar shortcut for AI and that has to be redone with each new version. I tried making a shortcut with this environment variable but it won't work with the com file. Any chance you could also make a variable for the exe file? Or another way to have a consistent task bar shortcut?
Regarding this, are you saying that after an upgrade, the shortcut becomes unavailable (e.g. a white file)?

If so, I'm afraid that there isn't much we can do about this, as this is some old limitation from Windows Installer that has not yet been fixed.

If that's not what you meant, please give me some more details so I can better assist here.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
sfaust
Posts: 57
Joined: Tue Oct 13, 2015 11:57 pm

Re: Advanced Installer Predictable Directory

Yes that's what I meant, ok no worries thank you.
Catalin
Posts: 7305
Joined: Wed Jun 13, 2018 7:49 am

Re: Advanced Installer Predictable Directory

You are always welcome, Stephan!

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

Return to “Feature Requests”