Absolute path problem



Hello Everybody!
Sorry for my bad english!
I have great great VBScript which helps me to install fonts!
But I want to change the absolute path "C:\Documents and Settings\Administrator\Desktop\Fonts" with %userprofile%\Desktop



Const FONTS = &H14&
Const ForAppending = 8
Dim fso
doexist = 0
dontexist = 0
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.Namespace(FONTS)
set oShell = CreateObject("WScript.Shell")
strSystemRootDir = oshell.ExpandEnvironmentStrings("%systemroot%")
strFontDir = strSystemRootDir & "\fonts\"
strTempDir = oshell.ExpandEnvironmentStrings("%systemroot%") & "\temp"
Set fso = CreateObject("Scripting.FileSystemObject")
Set objDictionary = CreateObject("Scripting.Dictionary")
objDictionary.CompareMode = TextMode
Set f1 = FSO.createTextFile(strTempDir & "\installed_fonts.txt", ForAppending)

CollectFonts
InstallFonts "C:\Documents and Settings\Administrator\Desktop\Fonts" ' insert path here to font folder

wscript.echo doexist & " fonts already installed." & vbcrlf & dontexist & " new fonts installed."

'===================================================================
Public Sub CollectFonts
'===================================================================
set colItems = objfolder.Items
For each ObjItem in ColItems
If LCase(Right(objItem.Name, 3)) = "ttf" or _
LCase(Right(objItem.Name, 3)) = "otf" or _
LCase(Right(objItem.Name, 3)) = "pfm" or _
LCase(Right(objItem.Name, 3)) = "fon" Then
If Not objDictionary.Exists(LCase(ObjItem.Name)) Then
objDictionary.Add LCase(ObjItem.Name), LCase(ObjItem.Name)
End If
End If
Next
For each ObjItem in ObjDictionary
f1.writeline ObjDictionary.Item(objItem)
Next
End Sub

'===================================================================
Public Sub InstallFonts(Folder)
'===================================================================
Set FontFolder = fso.getfolder(Folder)
For Each File in FontFolder.Files
If LCase(fso.GetExtensionName(File))="ttf" or _
LCase(fso.GetExtensionName(File))="otf" or _
LCase(fso.GetExtensionName(File))="pfm" or _
LCase(fso.GetExtensionName(File))="fon" Then
'check if Font is Already installed. If not, Install
If objDictionary.Exists(lcase(fso.GetFileName(File))) then
' wscript.echo fso.GetFileName(File) & " already exists in " & strFontDir
doexist = doexist + 1
Else
' wscript.echo fso.GetAbsolutePathName(File) & " doesn't exists in " & strFontDir
objFolder.CopyHere FontFolder & "\" & fso.GetFileName(File)
dontexist = dontexist + 1
end If
End If
Next
For Each SubFolder in FontFolder.subFolders
InstallFonts SubFolder
Next
End Sub





How can I do that?
Please help me!
Thank you very much!!!
:)
.



Relevant Pages

  • Re: Absolute path problem
    ... much less a fonts folder. ... | Public Sub InstallFonts ... If not, Install ...
    (microsoft.public.scripting.vbscript)
  • Re: Word (WordPDE module) crashes every time when Print->Save as PDF
    ... reinstalled from scratch using my install disk, ... duplicate fonts screwing things up for Safari. ... duplicates came back. ... that happens to be the only installed copy you can reinstall if it's a font ...
    (microsoft.public.mac.office.word)
  • Re: Reflection, Japanese, and UTF-8 on Win2000?
    ... To install international fonts ... your PC is configured for a code page that the Reflection installer does not ... recognize then a Typical Installation will not install the fonts you need. ... Reflection provides a complete set of international fonts. ...
    (comp.sys.hp.mpe)
  • Re: msttcorefonts install breaks FC6 printing, help!
    ... see that amanda is unable to print her backup reports. ... When the rpm ran its postinstall thing, it only does two things, ... Did you copy some fonts ... For this install, ...
    (Fedora)
  • Re: Reflection, Japanese, and UTF-8 on Win2000?
    ... More fonts showed up in Setup, Display, Fonts, but alas Arial Unicode MS is not ... Reflection installer should detect the character set used by Windows and automatically install the relevant international font files. ... If your PC is configured for a code page that the Reflection installer does not recognize then a Typical Installation will not install the fonts you need. ... But I am not seeing the Japanese characters rendered as Japanese characters on my screen. ...
    (comp.sys.hp.mpe)