Changes

Jump to: navigation, search

Fonts

312 bytes added, 19:46, 7 October 2011
Example using a VBscript
</source>
Or, to install all .ttf , .otf, .pfm, .fon files from the folder containing your FontInstall.vbs script:
<source lang="vb">
Const FONTS = &H14& Set objShell = CreateObject("Shell.Application")Set ofso = CreateObject("Scripting.FileSystemObject") SourceFolder = ofso.GetParentFolderName(Wscript.ScriptFullName)Set oSource = objShell.Namespace(SourceFolder)Set oWinFonts = objShell.Namespace(FONTS) ' 4 f*ing lines instead of just "if (/\.ttf$/i)". I hate VBscript!!!Set rxTTF = New RegExprxTTF.IgnoreCase = TruerxTTF.Pattern = "\.ttf$"
Set regEx = New RegExp
regEx.IgnoreCase = True
regEx.Pattern = "([A-Za-z0-9\s]+_*?)(_[^_]*)?(\.(ttf|otf|pfm|fon))$"
FOR EACH FontFile IN oSource.Items()
' FontFile may be without fontFileName = ofso.ttf extension! Use GetFileName(FontFile.Path) IF rxTTFregEx.Test(FontFilefontFileName) THEN Set objMatch = regEx.Execute(fontFileName) win7FontFileName = objMatch.Item(0).Submatches(0) & objMatch.Item(0).Submatches(2) localFontPath = oWinFonts.Self.Path& "\" & fontFileName win7LocalFontPath = oWinFonts.Self.Path & "\" & win7FontFileName IF NOT ofso.FileExists(localFontPath) AND NOT ofso.FileExists(win7LocalFontPath) THEN oWinFonts.CopyHere FontFile.Path END IF END IF
NEXT
</source>
2
edits

Navigation menu