Advertisement
Guest User

Font install

a guest
Nov 15th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.26 KB | None | 0 0
  1. Option Explicit
  2. ' Installing multiple Fonts in Windows 7
  3. ' http://www.cloudtec.ch 2011
  4.  
  5. Dim objShell, objFSO, wshShell
  6. Dim strFontSourcePath, objFolder, objFont, objNameSpace, objFile
  7.  
  8. Set objShell = CreateObject("Shell.Application")
  9. Set wshShell = CreateObject("WScript.Shell")
  10. Set objFSO = createobject("Scripting.Filesystemobject")
  11.  
  12. 'Wscript.Echo "--------------------------------------"
  13. 'Wscript.Echo " Install Fonts "
  14. 'Wscript.Echo "--------------------------------------"
  15. 'Wscript.Echo " "
  16.  
  17. strFontSourcePath = "C:\Windows\Temp\fonts"
  18.  
  19. If objFSO.FolderExists(strFontSourcePath) Then
  20.  
  21. Set objNameSpace = objShell.Namespace(strFontSourcePath)
  22. Set objFolder = objFSO.getFolder(strFontSourcePath)
  23.  
  24. For Each objFile In objFolder.files
  25.  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
  26.   If objFSO.FileExists("C:\Windows\Fonts" & objFile.Name) Then
  27.    'Wscript.Echo "Font already installed: " & objFont
  28.   Else
  29.    Set objFont = objNameSpace.ParseName(objFile.Name)
  30.    objFont.InvokeVerb("Install")
  31.    'Wscript.Echo "Installed Font: " & objFont
  32.    Set objFont = Nothing
  33.   End If
  34.  End If
  35. Next
  36. Else
  37.  'Wscript.Echo "Font Source Path does not exists"
  38. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement