Re: Font per vbs installieren
- From: Bernhard Triller <Bernhard Triller@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Thu, 5 Jul 2007 05:30:01 -0700
Hallo,
ich habe mir versucht das Script auf meine Bedürfnisse abzuandern.
oFolderCopy ist fix. Und ich muss zuerst die alten Fonts löschen da sie schon
existieren. Das geht soweit gut. Jedoch löscht er der allerersten Font nicht
oder nicht ganz. Alle anderen danach jedoch schon. Deshalb werden alle bis
auf den ersten installiert. auch kommt deshalb die Meldung hoch diesen Font
zuererst zu deinstallieren. Was habe ich falsch gemacht? Danke für jegliche
Hilfe!!! Gruß Bernhard
<Script Start>
' ###########################################
' # installfont.vbs #
' # installs font file in windows fonts dir #
' # (c) 2007 by Gottfried Mayer #
' ###########################################
Dim oFSO, oApp, oFolderCopy, oShell
Dim strFontsPath, strScriptPath
' Create needed Objects
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")
Set oApp = CreateObject("Shell.Application")
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objFSO = CreateObject("Scripting.FileSystemObject")
' Get Path of Windows Fonts directory
strFontsPath = oShell.ExpandEnvironmentStrings("%WINDIR%") & "\Fonts"
' Get Folder Object of Fonts directory (i.E. C:\Scripts\FontsToInstall )
Set oFolderCopy = oApp.Namespace("K:\Update\WTS\Fonts")
' Check each Font if it already is installed
For Each oFont In oFolderCopy.Items
If oFSO.FileExists(strFontsPath & "\" & oFont.Name) Then
objFS.DeleteFile(strFontsPath & "\" & oFont.Name)
End If
Next
For Each oFont In oFolderCopy.Items
If NOT oFSO.FileExists(strFontsPath & "\" & oFont.Name) Then
' Tell Explorer to copy the Font - this correctly installs it.
oApp.Namespace(strFontsPath).CopyHere oFont
End If
Next
' Cleanup Objects
Set oFolderCopy = Nothing
Set oApp = Nothing
Set oShell = Nothing
'Set oFSO = Nothing
<Script Ende>
"Gottfried Mayer" wrote:
Hallo Axel,
Ich hab mal so kurz ein Script zusammengesetzt, das die Schriftart
installieren kann:
Wenn du einfach mit File.Copy vorgehst funktioniert es nicht, wenn du
aber dem Explorer sagst, die Datei zu kopieren dann läufts (und er
registriert die Schriftart auch korrekt.)
Um die Meldung "eine andere Version dieser Schriftart ist bereits
installiert... blabla..." zu überspringen hab ich auch noch eine
Überprüfung auf das Vorhandensein der Schriftart eingebaut:
Das Script benötigt einen Ordner "FontsToInstall" im Verzeichnis wo das
Script liegt, da liegen alle zu installierenden Schriftarten drin.
.
- Follow-Ups:
- Re: Font per vbs installieren
- From: Gottfried Mayer
- Re: Font per vbs installieren
- Prev by Date: Re: if Abfrage über like
- Next by Date: Re: Font per vbs installieren
- Previous by thread: if Abfrage über like
- Next by thread: Re: Font per vbs installieren
- Index(es):
Relevant Pages
|