Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Explicit
- ' Installing multiple Fonts in Windows 7
- ' http://www.cloudtec.ch 2011
- Dim objShell, objFSO, wshShell
- Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile
- Set objShell = CreateObject("Shell.Application")
- Set wshShell = CreateObject("WScript.Shell")
- Set objFSO = createobject("Scripting.Filesystemobject")
- 'Wscript.Echo "--------------------------------------"
- 'Wscript.Echo " Install Fonts "
- 'Wscript.Echo "--------------------------------------"
- 'Wscript.Echo " "
- strFontSourcePath = "C:\Windows\Temp\fonts"
- If objFSO.FolderExists(strFontSourcePath) Then
- Set objNameSpace = objShell.Namespace(strFontSourcePath)
- Set objFolder = objFSO.getFolder(strFontSourcePath)
- For Each objFile In objFolder.files
- If LCase(right(objFile,4)) = ".ttf" OR LCase(right(objFile,4)) = ".otf" OR LCase(right(objFile,4)) = ".pfm" OR LCase(right(objFile,4)) = ".fon" Then
- If objFSO.FileExists("C:\Windows\Fonts" & objFile.Name) Then
- 'Wscript.Echo "Font already installed: " & objFont
- Else
- Set objFont = objNameSpace.ParseName(objFile.Name)
- objFont.InvokeVerb("Install")
- 'Wscript.Echo "Installed Font: " & objFont
- Set objFont = Nothing
- End If
- End If
- Next
- Else
- 'Wscript.Echo "Font Source Path does not exists"
- End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement