Font Installer Script: Easily install fonts with your setups
I am writing this post to teach you how can you install fonts with your setups.Here i”ll teach you to write a font installer script so that you can use it to run with other setups.
I have been using this font installer script in each of my theme setup.You can see that fonts install with the setups of my themes, you dont have to manually install them. Here’s the small tutorial to do so:
Open notepad and paste the following code:
set winsh = CreateObject("WScript.Shell") set winenv = winsh.Environment("Process") windir = winenv("WINDIR") Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace("C:\Windows\Resources\Themes\Alienware Evolution\Fonts") Set objFolderItem = objFolder.ParseName("autobahn_stencil.ttf") objFolderItem.InvokeVerb("Install")
Now have a look at the code above,in 5th line where I have placed C:\Windows\Resources\Themes\Alienware Evolution\Fonts you have to type the font folder path.Like for example my Font file was located in C:\Windows\Resources\Themes\Alienware Evolution\Fonts but you can type any other location like C:\ or C:\Windows etc.
Now the 6th line contains the name of the font file.You can see I will be installing autobahn_stencil.ttf using this script.You can type any font name instead but make sure the font is located in the folder which you have typed in line 5.
Now if you want to install multiple fonts then you can simple copy the code and paste again & again, make sure you change the folder and font name.
Here’s the code:
Set objShell = CreateObject("Shell.Application") Set objFolder = objShell.Namespace("C:\Windows\Resources\Themes\Alienware Evolution\Fonts") Set objFolderItem = objFolder.ParseName("autobahn_stencil.ttf") objFolderItem.InvokeVerb("Install")
Now save it as anyname.vbs and make sure save as type is All Files(*.*)
Test the script by double clicking on anyname.vbs
Step 5: How to implement it in a installer?
That’s a big question that how to use it with the installer?Simple it is , if you want to use it with Winrar SFX installer then what you can do is decide the location of font files ie after extraction where they will be copied.Then add that location to above code.Pack the script and the font files together with winrar sfx and in the option of SFX , you will find run after Extraction option.Type your .vbs file name there like anyname.vbs
Step 6: (Optional Skip step 5 instead)
What i do is instead of Winrar SFX i use a software Smart Install Maker.It’s very user friendly software and i have been building my theme’s setups using that software , in the next post i”ll teach you how to make setups with that.