curt.blunt
Posts: 23
Joined: Tue Oct 18, 2022 11:05 am
Location: Remote

Powershell Inline Script - Font install

Hi,

I would like to install Lato font as a custom powershell inline script that runs at the Wizard Dialog Stage

The script runs fine, however the fonts do not get installed, I don't think it can find the font files correctly - what is best procedure to install something placed in APPDIR location

Code: Select all

param($AppPath)

$AppPath = $AppPath.TrimEnd('\')
write-output "Path = $AppPath"

cd 'Resources\Fonts'
Copy-Item "Lato-Bold.ttf" -Destination "C:\Windows\Fonts"
Copy-Item "Lato-Light.ttf" -Destination "C:\Windows\Fonts"
Copy-Item "Lato-Regular.ttf" -Destination "C:\Windows\Fonts"
Copy-Item "Lato-Thin.ttf" -Destination "C:\Windows\Fonts"
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Lato Bold (OpenType)" /t REG_SZ /d Lato-Bold.ttf /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Lato-Light (OpenType)" /t REG_SZ /d Lato-Light.ttf /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Lato Regular (OpenType)" /t REG_SZ /d Lato-Regular.ttf /f
reg add "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts" /v "Lato-Hairline (OpenType)" /t REG_SZ /d Lato-Thin.ttf /f
Image

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

Re: Powershell Inline Script - Font install

Hello Curt,

Most likely, the issue in your case is that you are executing the custom action early when the files are not availalbe to your custom action.

To avoid this, you can add the fonts as temporary files.

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

Return to “Building Installers”