+ Post New Thread
Results 1 to 9 of 9
Windows 7 Thread, Windows 7 fonts Installing nightmare in Technical; RIGHTT!!!! I have spent about 2.5 hours this afternoon working on trying to install fonts automatically in Windows 7 from ...
  1. #1

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    192
    Thank Post
    20
    Thanked 8 Times in 8 Posts
    Rep Power
    10

    Windows 7 fonts Installing nightmare

    RIGHTT!!!!

    I have spent about 2.5 hours this afternoon working on trying to install fonts automatically in Windows 7 from a script!

    So far, I have come up with a basic script that installs the script fine at startup, but it can't seem to check in anyway, whether the font already exists....

    Can anyone give me some help with my script - its a vbscript, as below:

    Code:
    ' Fonts.installer
    ' ----------------------------------------------------------
    Option Explicit
    
    Dim objShell, objFolder
    
    Const FONTS = &H14&
    
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    objFolder.CopyHere "\\%server%\%sharename%\!Y2KBUG.ttf"
    
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    objFolder.CopyHere "\\%server%\%sharename%\$FIVEDOU.ttf"
    
    Wscript.Quit
    I don't know if it is something special to do with the Windows/Fonts directory in Windows 7, but nothing I do, can seem to check the exisitance of a font already in the directory....

    Can anyone help!

    Cheers
    _techie_

  2. IDG Tech News
  3. #2

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,203
    Thank Post
    250
    Thanked 396 Times in 371 Posts
    Rep Power
    156
    Quote Originally Posted by _techie_ View Post
    So far, I have come up with a basic script that installs the script fine at startup, but it can't seem to check in anyway, whether the font already exists....

    Can anyone give me some help with my script - its a vbscript, as below:
    Can you show the code you're trying to use to check if they exist? Easier to see if something's wrong if you post it

    Steve

  4. #3

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    192
    Thank Post
    20
    Thanked 8 Times in 8 Posts
    Rep Power
    10
    I have posted the code in my previous post.

    ^^^ Cheers
    _techie_

  5. #4

    Steve21's Avatar
    Join Date
    Feb 2011
    Location
    Swindon
    Posts
    2,203
    Thank Post
    250
    Thanked 396 Times in 371 Posts
    Rep Power
    156
    Quote Originally Posted by _techie_ View Post
    I have posted the code in my previous post.

    ^^^ Cheers
    _techie_
    Well you haven't checked if files exist at all... Nor do you have any variables etc etc :P

    So did you try to check it, or prefer just full version posted? :P Don't mind either way

    Try this:

    Code:
    On error resume next
    dim fontlist(3),root,path,check,filelist
    fontlist(0)="font1.TTF"
    fontlist(1)="font2.TTF"
    fontlist(2)="font3.TTF"
    fontlist(3)="font4.TTF"
    
    Set fso = CreateObject("Scripting.FileSystemObject") 
    filepath = fso.GetParentFolderName(wscript.ScriptFullName)
    
    set wshShell = Wscript.CreateObject("Wscript.shell")
    fontpath = wshShell.ExpandEnvironmentStrings("%windir%")
    
    Const FONTS = &H14&
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
    
    for each font in fontlist
    	copyto=filepath+"\"+font
    	check_file=fontpath+"\fonts\"+font
    	if fso.FileExists(check_file) then
    		root=0
    	else
    		objFolder.CopyHere copyto
    	end if
    next
    Steve

  6. #5


    Join Date
    Feb 2007
    Location
    51.405546, -0.510212
    Posts
    5,891
    Thank Post
    180
    Thanked 1,785 Times in 1,328 Posts
    Rep Power
    466

  7. #6

    ZeroHour's Avatar
    Join Date
    Dec 2005
    Location
    Scotland
    Posts
    5,821
    Blog Entries
    1
    Thank Post
    783
    Thanked 1,136 Times in 681 Posts
    Rep Power
    320
    Here is a script that works.
    Code:
    Const FONTS = &H14&
    
    Dim wsh
    Set wsh = WScript.CreateObject("Wscript.Shell")
    
    function LogtoEvent (MSG,success)
    	select case success
    		case 1	wsh.LogEvent EVENT_SUCCESS, MSG ' 1 is a success
    		case 0	wsh.LogEvent EVENT_FAILURE, MSG ' 0 is a error
    		case 2	wsh.LogEvent EVENT_WARNING, MSG ' 2 is a warning
    		case 3	wsh.LogEvent EVENT_INFORMATION, MSG ' do not use
    	end select
    end function
    LogtoEvent "INSTALL FONTS: Started Installing Fonts",1
    
    strSource = "\\{UNC PATH TO DIR WITH FONTS}"
    arrFiles = Array("{FONT NAME.ttf", "{ANOTHER FONT NAME.ttf}")
     
    Set objShell = CreateObject("Shell.Application")
    Set objFolder = objShell.Namespace(FONTS)
     
    For Each strFile in arrFiles
        Set objFolderItem = objFolder.ParseName(strFile)
        
        If objFolderItem is nothing Then
        	LogtoEvent "INSTALL FONTS: Installing " & strFile,1
            objFolder.CopyHere strSource & "\" & strFile, &H4&
        End If
    Next
    
    LogtoEvent "INSTALL FONTS: Done",1
    This leaves entries in the event log too ftw

  8. #7

    Join Date
    Jan 2009
    Location
    United Kingdom
    Posts
    192
    Thank Post
    20
    Thanked 8 Times in 8 Posts
    Rep Power
    10
    in answer to steve21

    well..I ran a BAT file with the following:

    @echo OFF
    IF EXIST "C:\WINDOWS\Fonts\!Y2KBUG.ttf" GOTO END
    wscript.exe "C:\font_installer.vbs"
    :End
    ECHO Font installed correctly

    However...this just went straight to End immediately!
    If I just run the wscript.exe part it installs the fonts fine, but just repeats the issue everytime the bat file runs :-(

  9. #8


    Join Date
    Mar 2009
    Location
    Leeds
    Posts
    4,700
    Thank Post
    169
    Thanked 637 Times in 550 Posts
    Rep Power
    204
    i just used winstall and made an msi that has worked for me in he past if i needed to get fonts to a win7 box

  10. #9
    enjay's Avatar
    Join Date
    Apr 2007
    Location
    Reading, Berkshire, UK
    Posts
    4,342
    Thank Post
    267
    Thanked 190 Times in 162 Posts
    Rep Power
    72
    Quote Originally Posted by ZeroHour View Post
    Here is a script that works.
    So I should save that as a .vbs and stick it in NetLogon, yes?

SHARE:
+ Post New Thread

Similar Threads

  1. Installing/Copying Fonts from Login Script
    By mattpant in forum Windows
    Replies: 10
    Last Post: 11th August 2011, 09:24 PM
  2. Replies: 0
    Last Post: 19th May 2011, 11:42 AM
  3. Installing Fonts
    By RabbieBurns in forum Windows 7
    Replies: 2
    Last Post: 28th May 2010, 03:07 PM
  4. Installing Fonts
    By enjay in forum How do you do....it?
    Replies: 10
    Last Post: 11th September 2009, 01:51 PM
  5. Visual Studio 6 on XP : Nightmare installing!
    By googlemad in forum Windows
    Replies: 2
    Last Post: 22nd October 2007, 01:05 PM

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •